FND / tiddlywebplugins.bfw

Barely Functioning Wiki, emphasizing micro-content
0 stars 2 forks source link

avoid system settings in tiddlywebconfig.py #51

Open FND opened 10 years ago

FND commented 10 years ago

currently bfwinstance produces a tiddlywebconfig.py that looks like this:

config = {
    'secret': '...',
    'twanager_plugins': ['tiddlywebplugins.tagdex', 'tiddlywebplugins.bfw'],
    'system_plugins': ['tiddlywebplugins.static', 'tiddlywebplugins.tagdex',
            'tiddlywebplugins.bfw'],
    'markdown.wiki_link_base': '',
    'markdown.extensions': (['markdown_checklist.extension'], {}),
}

only secret is actually specific to the respective instance and thus belongs into its tiddlywebconfig.py - the rest should be read directly from the BFW package to avoid manual intervention when upgrading that package:

from tiddlywebplugins.bfw.instance import merge_with_instance_config

merge_with_instance_config({
    'secret': '...'
})

(obviously this mechanism needs to allow for instance-specific plugins and other customizations)

seems like this is something that needs to be addressed by imaker, but I'm not sure exactly how - @cdent?


FWIW, this appears to work, but it's not something instance administrators should have to bother with:

instance_config = {
    'secret': '...'
}

from tiddlywebplugins.bfw.instance import instance_config as default_config
config = default_config.copy()
config.update(instance_config)
cdent commented 10 years ago

You seem to have some of your logic backwards. Have a look at how things like tank, tiddlyspace, maybe hoster and a few other plugins have an internal to the package config.py which is merged when the plugin is init().

tiddlywebconfig.py still must include server_plugins and twanager_plugins of at least the plugin which identifies the type of instance. That plugin can then be responsible for the loading of things like markdown settings.

FND commented 10 years ago

I had to go imperative in order to make this work: 4e92373b1d1d8f96926dd3022eb68569939d0c0b - though this might be due to my continued lack of understanding of this whole process, so suggestions welcome.