j139 dotenv: strip trailing inline comments and warn on non-token values
A `#` preceded by whitespace and outside quotes now ends the value, so `TR_DEBUG_DRAW=0 # hides the grid` resolves to `0` instead of the whole tail. Values that are still not plain tokens (whitespace, `#`, an unclosed quote) get one `[dotenv] WARNING` line naming file, key, raw value and the fact that the reader falls back to its DEFAULT, instead of being applied silently. Guard test 29 -> 47 checks.
This commit is contained in:
@@ -8,7 +8,9 @@ surprise you.
|
||||
|
||||
1. In the bot folder, copy `.env.example` to `.env`.
|
||||
2. Open `.env` and set the knobs you want. One `KEY=VALUE` per line. Lines
|
||||
starting with `#` are comments.
|
||||
starting with `#` are comments. A trailing comment is allowed and stripped
|
||||
(`KEY=0 # off`) as long as the `#` is outside quotes; a value that still
|
||||
contains whitespace or a `#` after that gets one `[dotenv] WARNING` line.
|
||||
3. Start the bot from the bot folder (`./ModularBot`). It picks up `.env`
|
||||
automatically.
|
||||
4. To use a different file, pass it on the command line:
|
||||
|
||||
Reference in New Issue
Block a user