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

Add support for 'environments' #10

Open
10 tasks
SamJakob opened this issue Nov 26, 2023 · 0 comments
Open
10 tasks

Add support for 'environments' #10

SamJakob opened this issue Nov 26, 2023 · 0 comments
Assignees
Labels
p1 Priority One. To be completed ASAP!

Comments

@SamJakob
Copy link
Member

This can be in the form of a cinnamon.toml that is unique to a specific environment and dynamically selectable with NODE_ENV or CINNAMON_ENV (as an option for where NODE_ENV might, inexplicably, affect other code).

  • Replace cinnamon.toml/framework.core.development_mode with true environment variables (as it is overridden by them historically anyway).
    • To avoid confusion, remove cinnamon.toml/framework.core.development_mode: ignore its value and, if set, provide an error message or warning to the user that they must migrate. (This property was easier to work with initially and used to mean less, but now it affects many behaviors - particularly security-related functionality can potentially be accidentally left enabled when deploying).
    • Start the framework in development mode IF AND ONLY IF NODE_ENV === "development" OR CINNAMON_ENV === "development"
    • CINNAMON_ENV takes priority over NODE_ENV when set (but we will recommend that everybody use NODE_ENV in docs, etc., for consistency).
    • Add yarn dev to package.json as well as yarn start which can just set the environment variable.
  • The Cinnamon environment (core/framework.environment) will now be set as follows:
    • If CINNAMON_ENV is set and not empty, its exact string value will be used as the environment name. Otherwise,
    • If NODE_ENV is set and not empty, its exact string value will be used as the environment name. Otherwise,
    • The framework will be started in production mode "production".
  • core/framework.environment will be added and equal to the environment string and inDevMode will now be a getter for core/framework.environment === "development"
  • The main cinnamon.toml file will be loaded as always, however if cinnamon.<environment>.toml exists, it will be loaded too and its properties will be deep merged onto the existing configuration (from cinnamon.toml).

To give projects control over setting up the environment:

  • If cinnamon.<environment>.toml does not exist, but cinnamon.<environment>.dist.toml does exist BUT there are placeholder values (to be decided and documented) in the file: create-cinnamon-project will be invoked if possible to handle copying the file and prompting the user for placeholder values OR an error message about the file needing to be created will be displayed and the framework will terminate.
  • Alternatively, if no placeholder values exist, the file will just be silently copied during startup.
@SamJakob SamJakob added the p1 Priority One. To be completed ASAP! label Nov 26, 2023
@SamJakob SamJakob self-assigned this Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 Priority One. To be completed ASAP!
Projects
None yet
Development

No branches or pull requests

1 participant