(untested) http basic auth for outboard secrets
This commit is contained in:
@@ -26,6 +26,15 @@ in {
|
||||
description = "source url";
|
||||
type = types.strMatching "https?://.*";
|
||||
};
|
||||
username = mkOption {
|
||||
description = "username for HTTP basic auth";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
password = mkOption {
|
||||
description = "password for HTTP basic auth";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
description = "service name";
|
||||
type = types.str;
|
||||
|
@@ -1,14 +1,19 @@
|
||||
{
|
||||
liminix, lib, json-to-fstree, serviceFns
|
||||
}:
|
||||
{ name, url, interval } :
|
||||
{ name, url, interval, username, password } :
|
||||
let
|
||||
inherit (liminix.services) oneshot longrun;
|
||||
inherit (lib) optionalString;
|
||||
in longrun {
|
||||
inherit name;
|
||||
buildInputs = [ json-to-fstree ];
|
||||
run = ''
|
||||
. ${serviceFns}
|
||||
${optionalString (username != null) ''
|
||||
export NETRC=$(mkstate ${name})/netrc
|
||||
(echo default ; echo login ${username} ; echo password ${password} ) > $NETRC
|
||||
''}
|
||||
( in_outputs ${name}
|
||||
while : ; do
|
||||
${json-to-fstree}/bin/json-to-fstree ${url} .
|
||||
|
Reference in New Issue
Block a user