scragg0x / realms-wiki

Git based wiki inspired by Gollum
http://realms.io
GNU General Public License v2.0
833 stars 91 forks source link

Use properties in config for pass-through compat vars #139

Closed nakato closed 8 years ago

nakato commented 8 years ago

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

scragg0x commented 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.

nakato commented 8 years ago

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?

scragg0x commented 8 years ago

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.