Read the environment with typed parsers and apply the documented defaults

set_defaults() assigned os.getenv() results directly, which overwrote the
argparse defaults with None whenever a variable was unset. A default container
therefore ran "seaf-cli config -k delete_confirm_threshold -v None", and the
same for upload_limit and download_limit: none of the three documented
defaults were ever applied.

SEAFILE_UID and SEAFILE_GID had a second problem. argparse type=int applies
only to command line flags, never to set_defaults, so both stayed strings.
The check in setup_uid compares them against pwd integers, and a string is
never equal to one, so usermod ran on every start.

dsc/config.py reads each variable with its documented default and rejects a
malformed or negative value at startup, naming the variable, instead of
passing it on. An empty variable counts as unset.

Booleans are now rendered as true and false rather than Python's True and
False. The daemon reads disable_verify_certificate with its boolean accessor,
which does not recognise the capitalised form. I could not run the daemon to
confirm the previous value's effect, since the AppImage is x86_64 only.

seaf-cli is no longer given a None value for any option.
This commit is contained in:
Maxim Shulga committed 2026-08-02 17:44:57 -07:00
1 parent 87b76b80f6
commit e6034a69a6
8 files changed
+283 -26

No files matched your search

+6 -1
View File
@@ -46,10 +46,15 @@ volumes:
- `DELETE_CONFIRM_THRESHOLD` - represents the number of files that require
confirmation before being deleted simultaneously. Default value is _500_.
- `DISABLE_VERIFY_CERTIFICATE` - set to _true_ to disable server's certificate
verification. Default value is _false_.
verification. Default value is _false_. Booleans accept _true_/_false_,
_1_/_0_, _yes_/_no_ and _on_/_off_, in any case.
- `UPLOAD_LIMIT` / `DOWNLOAD_LIMIT` - upload/download speed limit in B/s
(bytes per second). Default values are _0_ (unlimited).
Numeric variables must be whole, non-negative numbers. A malformed or negative
value stops the container at startup with a message naming the variable,
rather than being passed on to the Seafile client.
### Using Docker secrets:
Mount the secret and point `PASSWORD_FILE` at it, so the password never enters
the environment: