Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: offer to store api key locally #30

Merged
merged 1 commit into from
Nov 28, 2024
Merged

feat: offer to store api key locally #30

merged 1 commit into from
Nov 28, 2024

Conversation

grabbou
Copy link
Collaborator

@grabbou grabbou commented Nov 25, 2024

Offers to save to local env file and adds it to gitignore
Asks the question if empty key is provided

Fixes #26

Comment on lines +86 to +89
if (save) {
execSync(`echo "OPENAI_API_KEY=${apiKey}" >> .env.local`)
execSync(`echo ".env.local" >> .gitignore`)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if saving to each project is a good idea, some tools introduce their own config file for example ai-cli created ~/.airc.json: https://github.com/callstack/ai-cli

I think most of the time user is going to use the same key between every project, wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah maybe let’s write to global config, that’s what I did in my project haha

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did change this locally, but I am not sure what is the best way to save into global configuration, so I guess I am going to merge it for now "as is" and we can always re-iterate later!

@grabbou grabbou merged commit 88e8702 into main Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: save the Open AI Api Key when entered in the interactive mode
2 participants