facebook / dotslash

Simplified executable deployment
https://dotslash-cli.com
Apache License 2.0
557 stars 14 forks source link

[RFC] configuration file? #4

Open bolinfest opened 7 months ago

bolinfest commented 7 months ago

Currently, DotSlash does not support any sort of configuration file. The only thing that is really "configurable" is the location of the DotSlash cache folder, which defaults to the dotslash subfolder under the operating system's cache dir, but can be overridden via the DOTSLASH_CACHE environment variable.

An important advantage of this approach is that the "fast path" in the DotSlash execution flow (i.e., a cache hit):

https://dotslash-cli.com/docs/execution/

does not have to read any files other than the DotSlash file itself. Ideally, in adding support for a DotSlash config file, we would maintain this invariant. That is, the "fast path" should not have to read a config file, but the "slow path" is allowed to.

Config Options

Ideas we have kicked around in the past include:

Location

We probably want some sort of "cascading set" of config files were one can override another, such as:

File Format

To avoid an undue increase on the size of the DotSlash binary, we should use "jsonrc" as the config file format.

abesto commented 7 months ago

Location

Hierarchical configuration like this is great. Usually I'd expect to also see beyond what you already have:

I like https://rust-cli-recommendations.sunshowers.io/hierarchical-config.html for this.

bolinfest commented 7 months ago

By CONFIG_DIR I meant the thing that the linked Rust code could would return, which follows the XDG Base directory specification, so I guess I should have said XDG_CONFIG_HOME.

alilleybrinker commented 7 months ago

Is there is hierarchical configuration, it would be very useful to be able to ask the tool to display the config values it’s landed on, and ideally to report where each value is set. Can help with debugging when you expect the value to be one thing and it’s something else instead.