App Configs
In the previous chapter we built our first and simple app. And we had to
create an app.ini file to run it. So we can say that app configs
play a central role in spinning up your apps and developing WebFluid projects.
The core concept
App configs are the CLI's entry point into your project. They replace .env files and
tell the framework which app to run.
Primarily it is used to store secrets, potentially risky information (like database uris) and switches.
Switches are another core concept of WebFluid. The framework uses them to enroll features and extensions
on startup. Or in other words: They make the framework magic optioned.
Sections
App configs are parsed using Pythons configparser. Primarily, we are using sections to logically separate parts of your apps' configuration. A fully qualified example would look like this:
[general]
SECRET_KEY = supersecret
[data]
DATABASE_URI = sqlite:///test.db
REDIS_URI = redis://localhost:6379
[extensions]
EXT_SCHEDULING = 0
EXT_SQLALCHEMY = 1
EXT_BABEL = 1
EXT_EVENTS = 1
EXT_CACHE = 0
EXT_MAIL = 1
EXT_JWT = 0
[features]
WF_THEMES = 1
WF_TAILWIND = 1
WF_PROCESSING = 1
WF_ADDITIVES = 1
[mail]
MAIL_USERNAME = noreply@example.org
MAIL_PASSWORD = supersecret
We used "general" for our logical defaults, but since it is just logical separation, you are not forced to stick with our defaults. This, of course, applies to all the sections shown above.
Continue reading
From here you can continue straight with Config Classes.