Closed CyrilBrulebois closed 1 week ago
After discussion, the initial configuration provided by the user should be stored in /var/lib/pirogue/admin/user.config.yaml
Alright, since pirogue-admin
itself is supposed to be a kind of confidential tool (not something we advertise/document for users), and since --autodetect
is really meant for the initial deployment, via pirogue-base.postinst
, I'm tempted not to add any option for the user-provided configuration… and directly deal with it in the autodetection code, without any condition.
Logic:
If the file is present, can be read, and each key/value pair can be used to “merge” user settings with the autodetected settings, then those merged settings are returned.
If the file is present, but there are any exceptions triggered while trying to merge user settings, then only the autodetected settings are returned, with an error being logged. Note: I'm choosing not to abort the initial deployment, but maybe others will have a different opinion about this. Erroring out for real would mean keeping Debian packages half-installed/configured, which is not ideal.
If the file is absent, we're back to the original situation: we only return the autodetected settings.
Confirmed to be working fine with a fresh deployment:
sudo mkdir -p /var/lib/pirogue/admin/
sudo editor /var/lib/pirogue/admin/user.config.yaml # see below
sudo apt-get install pirogue-base -y
User configuration:
WIFI_SSID: ViRogueOne
WIFI_PASSPHRASE: AStarWarsStory
WIFI_COUNTRY_CODE: US
With the pre-
pirogue-admin
approach, it was possible to deploy a configuration file on the file system to tweak some variables before the initial installation/autodetection. It would be best to support that withpirogue-admin
as well.Two possibilities come to mind:
If a configuration file is present, it must list all settings. This would give us a chance to validate the consistency… except we don't do that when applying the configuration (at least not at the moment), we only check the settings we output during autodetection are consistent (we're merely applying heuristics while doing so).
If a configuration is present, it can list any settings, and those override whatever is returned by the autodetection code.
The latter seems to be the preferred approach.
The administration interface is going to present a subset of variables that are considered useful/likely-to-need-a-modification/safe-to-modify, and those will be mentioned in user-facing documentation.
It would probably make sense to support those variables quietly, while outputting some warnings when other variables are set.
Assigning to @U039b initially since at least one information is needed to start the implementation: the path and format of that file.
For reference, after a successful deployment (VPN case here), the
pirogue-admin
config file looks like this:If would probably make sense to support something like
/var/lib/pirogue/admin/user.yaml
?For reference, until now we've been telling users they can tweak the configuration via
/var/lib/pirogue/config/pirogue.user.env
while the main configuration used to be/var/lib/pirogue/config/pirogue.env
…So maybe
/var/lib/pirogue/admin/config.user.yaml
if we want to stay consistent?Those are merely suggestions, I'm fine with whatever path makes most sense, thanks!