Closed nakato closed 8 years ago
This is fine but can I suggest that we rename the class to Config
.
Also instead of instantiating in the config module, we can import the Config
class and create in create_app
if no config was passed. We can also pass a config instance to create app in the cli module.
Let me know if that is a lame idea.
I'll get the class name updated.
Not sure about the second part though. As it is, whenever the app imports realms.config, config.conf should always be the same object. So if a config variable such as ENV
needed to be changed, then flask and the oauth model will see that change as well.
Is there a use case you're trying to support that I'm not taking into account?
Don't worry about the 2nd part. The idea was to design create_app in such a way to deliver multiple different wikis in the same process. The plan needs more work than just this change so no need for it now.
The create_app
call in commands
is mainly used to discover command definitions in the modules. So there would be one config object used by Flask either way when the server is ran.
Strings are immutable, so when one variable changes the other will not, as such there is variance on config load between variables that should be the the value of another variable.
To solve that I've moved the config into a class and made those values read-only properties to the loaded values.
Closes: #137 #138