wikmd icon indicating copy to clipboard operation
wikmd copied to clipboard

Support command line options, especially for choosing a different wiki directory?

Open johann-petrak opened this issue 1 year ago • 3 comments

I think it would be convenient to be able to start the wiki using something like wikmd --dir /my/wikidir --conf myconfigfile.cfg

johann-petrak avatar Oct 17 '24 10:10 johann-petrak

@johann-petrak, you can use environment variables to specify the wiki directory like this:

WIKI_DIRECTORY="~/.wikidata" wikmd

Currently, setting the config file via environment variables isn't supported. If that's a feature you'd like, feel free to create a PR to add it! You can check out the relevant code here: https://github.com/Linbreux/wikmd/blob/6d2c7457f47394696cbbf3433d78e8a193446a2e/src/wikmd/config.py#L75-L76

If you have any questions or run into issues, don't hesitate to reach out!

Linbreux avatar Oct 17 '24 11:10 Linbreux

Is there some documentation what else can be set via environment variables?

personally I prefer the option to have command line options as this is a standard way to have a self-documenting software as all the options would then be easily detectable via the standard command wikmd --help and without reading any docs. It would also not require the creation of any additional files or directories. Would setting/overriding config options via the command line be something you would accept a PR for?

Another important setting would be the port to run on, as it would allow to run several instances/wikis in parallel on the same computer.

johann-petrak avatar Oct 17 '24 11:10 johann-petrak

Is there some documentation what else can be set via environment variables?

Here https://linbreux.github.io/wikmd/environment%20variables.html, you could also set the port here :smile:

Would setting/overriding config options via the command line be something you would accept a PR for?

For sure! That would indeed be a nice feature. Maybe the priority needs to be as followed:

  1. command line options
  2. ENV vars
  3. config file
  4. defaults

Linbreux avatar Oct 17 '24 12:10 Linbreux