flox icon indicating copy to clipboard operation
flox copied to clipboard

fix(config): Parse unquoted TOML keys

Open dcarley opened this issue 11 months ago • 0 comments

Proposed Changes

Allow TOML keys such as trusted_environments.foo/bar to be parsed without requiring any additional quoting from the user.

This fixes a regression that I introduced in 841d6b47 (not currently in a release version) where I accidentally dropped the quoting from some uses of the key, which prevented trust choices from being saved:

% flox activate -r nicklewis/example
⚠️  The environment nicklewis/example is not trusted.

flox environments do not run in a sandbox.
Activation hooks can run arbitrary code on your machine.
Thus, environments need to be trusted to be activated.
> Do you trust the environment nicklewis/example? Trust, save choice
❌ ERROR: Could not write token to config: Could not parse key: TOML parse error at line 1, column 31
  |
1 | trusted_environments.nicklewis/example
  |                               ^

It also fixes a longer standing bug from 1938 where the commands that we give for users to run don't work:

% flox activate -r nicklewis/example
❌ ERROR: Environment nicklewis/example is not trusted.

Run 'flox config --set trusted_environments.nicklewis/example trust' to trust it.
% flox config --set trusted_environments.nicklewis/example trust
❌ ERROR: Could not parse key: TOML parse error at line 1, column 31
  |
1 | trusted_environments.nicklewis/example
  |                               ^

Release Notes

flox config --set accepts nested keys with non-alphanumeric characters without requiring quoting, such as saving trust for remote environments.

dcarley avatar Apr 25 '25 08:04 dcarley