Add support for bearer tokens
This commit is contained in:
parent
ebb42250a7
commit
2596010ac9
1 changed files with 17 additions and 2 deletions
|
@ -122,6 +122,18 @@ let
|
||||||
description = "The path to a file containing the password obscured using the `rclone obscure` command for logging in to the ${displayName} server.";
|
description = "The path to a file containing the password obscured using the `rclone obscure` command for logging in to the ${displayName} server.";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bearerToken = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
description = "The bearer token for logging in to the ${displayName} server.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
bearerTokenFile = lib.mkOption {
|
||||||
|
type = lib.types.nullOr (lib.types.either lib.types.path lib.types.str);
|
||||||
|
description = "The path to a file containing the bearer token for logging in to the ${displayName} server.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -130,11 +142,14 @@ let
|
||||||
(mkIfNotNull config.vendor { inherit (config) vendor; })
|
(mkIfNotNull config.vendor { inherit (config) vendor; })
|
||||||
(mkIfNotNull config.username { user = config.username; })
|
(mkIfNotNull config.username { user = config.username; })
|
||||||
(mkIfNotNull config.obscuredPassword { pass = config.obscuredPassword; })
|
(mkIfNotNull config.obscuredPassword { pass = config.obscuredPassword; })
|
||||||
|
(mkIfNotNull config.bearerToken { bearer_token = config.bearerToken; })
|
||||||
];
|
];
|
||||||
|
|
||||||
secrets = lib.optionalAttrs (config.obscuredPasswordFile != null) {
|
secrets = (lib.optionalAttrs (config.obscuredPasswordFile != null) {
|
||||||
RCLONE_WEBDAV_PASS = config.obscuredPasswordFile;
|
RCLONE_WEBDAV_PASS = config.obscuredPasswordFile;
|
||||||
};
|
}) // (lib.optionalAttrs (config.bearerTokenFile != null) {
|
||||||
|
RCLONE_WEBDAV_BEARER_TOKEN = config.bearerTokenFile;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue