thombruce / toodles

✅ A super simple todo app
https://toodles.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

Allow general app config via file #88

Closed thombruce closed 3 months ago

thombruce commented 1 year ago

Related to #73

Also related to 5273a6dd71d2a751119e609e6f7e6808446c27ab which enables the base path to be configured as an environment variable.

I'd like it to be possible to configure options that way, but also to be able to use a file instead, say... toodles.config.ts.

Somewhere where base, history mode, app name, default language can all be configured, among whatever other options present themselves in future.

Precedent should be, what... ENV variable > config file > default

But at least the presence of a config file provides an intuitive source of truth that's easily adjusted in forked and derivative projects.

thombruce commented 1 year ago

Alternatives to toodles.config.ts:

File presence should be entirely optional (though we will probably include it by default), so I don't know if that rules out something like the ts option... Can it be conditionally imported?

thombruce commented 1 year ago

Dynamic imports likely possible: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import

See also: https://stackoverflow.com/questions/13444064/typescript-conditional-module-import-export