cluster/services/forge: use cluster secrets
This commit is contained in:
parent
04031ef198
commit
0c4e603e86
6 changed files with 15 additions and 26 deletions
|
@ -8,6 +8,15 @@
|
||||||
name = "forge";
|
name = "forge";
|
||||||
link.protocol = "http";
|
link.protocol = "http";
|
||||||
};
|
};
|
||||||
|
secrets = with config.services.forge.nodes; {
|
||||||
|
oidcSecret = {
|
||||||
|
nodes = server;
|
||||||
|
owner = "forgejo";
|
||||||
|
};
|
||||||
|
dbCredentials.nodes = server;
|
||||||
|
s3AccessKeyID.nodes = server;
|
||||||
|
s3SecretAccessKey.nodes = server;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ways.forge.target = let
|
ways.forge.target = let
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (depot.lib.meta) domain;
|
inherit (depot.lib.meta) domain;
|
||||||
inherit (depot.lib.nginx) vhosts;
|
inherit (cluster.config.services.forge) secrets;
|
||||||
inherit (config.age) secrets;
|
|
||||||
|
|
||||||
patroni = cluster.config.links.patroni-pg-access;
|
patroni = cluster.config.links.patroni-pg-access;
|
||||||
|
|
||||||
|
@ -24,25 +23,6 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
age.secrets = {
|
|
||||||
forgejoOidcSecret = {
|
|
||||||
file = ./credentials/forgejo-oidc-secret.age;
|
|
||||||
owner = "forgejo";
|
|
||||||
};
|
|
||||||
forgejoDbCredentials = {
|
|
||||||
file = ./credentials/forgejo-db-credentials.age;
|
|
||||||
owner = "forgejo";
|
|
||||||
};
|
|
||||||
forgejoS3AccessKeyID = {
|
|
||||||
file = ./credentials/forgejo-s3-access-key-id.age;
|
|
||||||
owner = "forgejo";
|
|
||||||
};
|
|
||||||
forgejoS3SecretAccessKey = {
|
|
||||||
file = ./credentials/forgejo-s3-secret-access-key.age;
|
|
||||||
owner = "forgejo";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.forgejo = {
|
services.forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = depot.packages.forgejo;
|
package = depot.packages.forgejo;
|
||||||
|
@ -54,7 +34,7 @@ in
|
||||||
inherit (patroni) port;
|
inherit (patroni) port;
|
||||||
name = "forge";
|
name = "forge";
|
||||||
user = "forge";
|
user = "forge";
|
||||||
passwordFile = secrets.forgejoDbCredentials.path;
|
passwordFile = secrets.dbCredentials.path;
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
DEFAULT = {
|
DEFAULT = {
|
||||||
|
@ -93,8 +73,8 @@ in
|
||||||
};
|
};
|
||||||
secrets = {
|
secrets = {
|
||||||
storage = {
|
storage = {
|
||||||
MINIO_ACCESS_KEY_ID = secrets.forgejoS3AccessKeyID.path;
|
MINIO_ACCESS_KEY_ID = secrets.s3AccessKeyID.path;
|
||||||
MINIO_SECRET_ACCESS_KEY = secrets.forgejoS3SecretAccessKey.path;
|
MINIO_SECRET_ACCESS_KEY = secrets.s3SecretAccessKey.path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -112,9 +92,9 @@ in
|
||||||
in lib.mkAfter /*bash*/ ''
|
in lib.mkAfter /*bash*/ ''
|
||||||
providerId="$(${exe} admin auth list | ${pkgs.gnugrep}/bin/grep -w '${providerName}' | cut -f1)"
|
providerId="$(${exe} admin auth list | ${pkgs.gnugrep}/bin/grep -w '${providerName}' | cut -f1)"
|
||||||
if [[ -z "$providerId" ]]; then
|
if [[ -z "$providerId" ]]; then
|
||||||
FORGEJO_ADMIN_OAUTH2_SECRET="$(< ${secrets.forgejoOidcSecret.path})" ${exe} admin auth add-oauth ${args}
|
FORGEJO_ADMIN_OAUTH2_SECRET="$(< ${secrets.oidcSecret.path})" ${exe} admin auth add-oauth ${args}
|
||||||
else
|
else
|
||||||
FORGEJO_ADMIN_OAUTH2_SECRET="$(< ${secrets.forgejoOidcSecret.path})" ${exe} admin auth update-oauth --id "$providerId" ${args}
|
FORGEJO_ADMIN_OAUTH2_SECRET="$(< ${secrets.oidcSecret.path})" ${exe} admin auth update-oauth --id "$providerId" ${args}
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue