Revert "nixos/mautrix-telegram: substitute secrets in config file at runtime (#112966)"
This is no longer necessary since mautrix-telegram v0.12.1, which
supports JSON-formatted environment variable and therefore maps
natively.
See: https://github.com/mautrix/telegram/issues/584#issuecomment-1250027272
See: https://github.com/mautrix/telegram/releases/tag/v0.12.1
This partially reverts commit 24133ead28
.
This commit is contained in:
parent
4a8f6ceb66
commit
e14bdbb997
|
@ -7,8 +7,8 @@ let
|
|||
registrationFile = "${dataDir}/telegram-registration.yaml";
|
||||
cfg = config.services.mautrix-telegram;
|
||||
settingsFormat = pkgs.formats.json {};
|
||||
settingsFileUnsubstituted = settingsFormat.generate "mautrix-telegram-config-unsubstituted.json" cfg.settings;
|
||||
settingsFile = "${dataDir}/config.json";
|
||||
settingsFile =
|
||||
settingsFormat.generate "mautrix-telegram-config.json" cfg.settings;
|
||||
|
||||
in {
|
||||
options = {
|
||||
|
@ -147,16 +147,6 @@ in {
|
|||
environment.HOME = dataDir;
|
||||
|
||||
preStart = ''
|
||||
# Not all secrets can be passed as environment variable (yet)
|
||||
# https://github.com/tulir/mautrix-telegram/issues/584
|
||||
[ -f ${settingsFile} ] && rm -f ${settingsFile}
|
||||
old_umask=$(umask)
|
||||
umask 0177
|
||||
${pkgs.envsubst}/bin/envsubst \
|
||||
-o ${settingsFile} \
|
||||
-i ${settingsFileUnsubstituted}
|
||||
umask $old_umask
|
||||
|
||||
# generate the appservice's registration file if absent
|
||||
if [ ! -f '${registrationFile}' ]; then
|
||||
${pkgs.mautrix-telegram}/bin/mautrix-telegram \
|
||||
|
@ -192,8 +182,6 @@ in {
|
|||
--config='${settingsFile}'
|
||||
'';
|
||||
};
|
||||
|
||||
restartTriggers = [ settingsFileUnsubstituted ];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue