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: Adding DEV, PROD, TEST environment variables #247

Open
JaeAeich opened this issue Dec 18, 2024 · 1 comment
Open

feat: Adding DEV, PROD, TEST environment variables #247

JaeAeich opened this issue Dec 18, 2024 · 1 comment

Comments

@JaeAeich
Copy link

JaeAeich commented Dec 18, 2024

I would like to be able to change the code of my application using env variables, eg change the port based on which mode the FOCA app is running or change the configuration etc. This might seem like a per project level requirement, but having this defined either in config.yaml with strict typing to standardize the variable name might be helpful.

For example being able to do something like:

# Development: Permissive CORS
if app.mode == APIMode.DEV:
    CORS(app, origins="*")

# Production: Strict CORS
if app.mode == APIMode.PROD:
    CORS(app, origins=["https://myapp.com"])

Maybe extra configs for those modes in config.yaml, with which we can overwrite some config fields.

environments:
  dev:
    server:
      debug: True
      port: 8080
      use_reloader: True
    
    db:
      host: localhost
      port: 27017

  prod:
    server:
      debug: False
      port: 80
      use_reloader: False
    
    log:
      root:
        level: 20
      handlers:
        console:
          level: 20

  staging:
    server:
      debug: False
      port: 8080
@kushagra189
Copy link
Contributor

Do you want to have bifurcation on the basis of different config files or a single config file? While I understand the need to such particulars, we might need to think on adding such support from a more holistic perspective as to have a long term solution based on scope and requirements. I like the idea of have a dedicated config for prod staging etc, but do we want to think in some additional directions as well? As to have a boiler plate based on different config files or to move such variables and abstract them out? Any additional thoughts?

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

No branches or pull requests

2 participants