Skip to content

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

Open
@JaeAeich

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions