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

Load .env files when launching from CLI #133

Merged
merged 9 commits into from
Sep 25, 2023
Merged

Load .env files when launching from CLI #133

merged 9 commits into from
Sep 25, 2023

Conversation

claytercek
Copy link
Member

@claytercek claytercek commented Sep 21, 2023

resolves #53

  • added support for .env files
  • updated documentation to reflect .env support and deprecate crendentials file
  • refactored config loading logic to allow loading the env between finding the config and loading the config
  • added additional CLI options for specifying env files

I refactored the ConfigManager to just be a couple of exported functions from config.js, as now that it's not a singleton, basically all of the methods were just static anyways.

@claytercek claytercek linked an issue Sep 21, 2023 that may be closed by this pull request
@claytercek
Copy link
Member Author

Tested this a bit more thoroughly, it feels stable to me!

I pulled any recommendation for using credentials.json from the docs, replacing it with .env examples and instructions, and noted credentialsPath as deprecated in the config options.

Copy link
Collaborator

@benjaminbojko benjaminbojko left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks for the PR. Only had one question about loadConfig() as defined in .docs/generate.mjs. Looks like maybe that's a relic?

Also, should we explicitly mark credentials.js as deprecated (the class and constructor itself)?

Great addition to the library, and will offer a lot more flexibility.

.docs/generate.mjs Outdated Show resolved Hide resolved
Copy link
Collaborator

@benjaminbojko benjaminbojko left a comment

Choose a reason for hiding this comment

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

Great! This looks good to merge to me. @claytercek Do you think we're at a good point to publish to NPM now? Also wondering if this actually constitutes to a minor change for all packages (minus scaffold) instead of just a patch at this point.

@claytercek
Copy link
Member Author

Deprecated the Credentials class and all its methods. Unfortunately, there's no way to mark the credentialsPath property in the content config options as deprecated with jsDoc, so I just noted it in the description.

@claytercek
Copy link
Member Author

Oh yeah, this probably makes more sense as a minor change. I'll update that and merge.

I think once this is merged it would be in a good spot to publish!

@claytercek claytercek merged commit 2b84c3b into develop Sep 25, 2023
@claytercek claytercek deleted the feat/dotenv branch September 25, 2023 16:10
@github-actions github-actions bot mentioned this pull request Sep 25, 2023
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.

Move credentials.json to .env file
2 participants