Small modules config restructure
Changed variables names in every module
This commit is contained in:
1 parent
c1d2e52bf8
commit
c92b90e406
83 files changed
+616
-523
No files matched your search
@@ -1,14 +1,15 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
poCfg = config.selfhosted.pocket-id;
|
||||
rootCfg = config.selfhosted;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
poCfg = rootCfg.pocket-id;
|
||||
domain = config.sops.placeholder."domains/serv";
|
||||
in
|
||||
{
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
sops.templates."seafile.env".content = ''
|
||||
SEAFILE_MYSQL_DB_HOST=${rootCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_HOST=${moduleCfg.mariadb.name}
|
||||
SEAFILE_MYSQL_DB_PORT=3306
|
||||
SEAFILE_MYSQL_DB_USER=seafile
|
||||
SEAFILE_MYSQL_DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
@@ -19,7 +20,7 @@ in
|
||||
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
|
||||
INIT_SEAFILE_ADMIN_EMAIL=${config.sops.placeholder."seafile/admin_email"}
|
||||
INIT_SEAFILE_ADMIN_PASSWORD=${config.sops.placeholder."seafile/admin_password"}
|
||||
SEAFILE_SERVER_HOSTNAME=${rootCfg.server.subdomain}.${domain}
|
||||
SEAFILE_SERVER_HOSTNAME=${moduleCfg.server.subdomain}.${domain}
|
||||
SEAFILE_SERVER_PROTOCOL=https
|
||||
SEAFILE_SERVER_LETSENCRYPT=false
|
||||
SITE_ROOT=/
|
||||
@@ -28,27 +29,27 @@ in
|
||||
SEAFILE_LOG_TO_STDOUT=false
|
||||
ENABLE_GO_FILESERVER=true
|
||||
CACHE_PROVIDER=redis
|
||||
REDIS_HOST=${rootCfg.redis.name}
|
||||
REDIS_HOST=${moduleCfg.redis.name}
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=${config.sops.placeholder."seafile/redis_password"}
|
||||
ENABLE_NOTIFICATION_SERVER=true
|
||||
INNER_NOTIFICATION_SERVER_URL=http://${rootCfg.notification.name}:8083
|
||||
NOTIFICATION_SERVER_URL=https://${rootCfg.server.subdomain}.${domain}/notification
|
||||
INNER_NOTIFICATION_SERVER_URL=http://${moduleCfg.notification.name}:8083
|
||||
NOTIFICATION_SERVER_URL=https://${moduleCfg.server.subdomain}.${domain}/notification
|
||||
ENABLE_SEAFILE_AI=false
|
||||
MD_FILE_COUNT_LIMIT=100000
|
||||
'';
|
||||
|
||||
sops.templates."seahub_settings.py".content = ''
|
||||
ENABLE_VIDEO_THUMBNAIL = True
|
||||
SERVICE_URL = "https://${rootCfg.server.subdomain}.${domain}"
|
||||
FILE_SERVER_ROOT = "https://${rootCfg.server.subdomain}.${domain}/seafhttp"
|
||||
SERVICE_URL = "https://${moduleCfg.server.subdomain}.${domain}"
|
||||
FILE_SERVER_ROOT = "https://${moduleCfg.server.subdomain}.${domain}/seafhttp"
|
||||
ENABLE_OAUTH = True
|
||||
OAUTH_CREATE_UNKNOWN_USER = True
|
||||
OAUTH_ACTIVATE_USER_AFTER_CREATION = True
|
||||
OAUTH_ENABLE_INSECURE_TRANSPORT = False
|
||||
OAUTH_CLIENT_ID = "${config.sops.placeholder."seafile/client_id"}"
|
||||
OAUTH_CLIENT_SECRET = "${config.sops.placeholder."seafile/client_secret"}"
|
||||
OAUTH_REDIRECT_URL = "https://${rootCfg.server.subdomain}.${domain}/oauth/callback"
|
||||
OAUTH_REDIRECT_URL = "https://${moduleCfg.server.subdomain}.${domain}/oauth/callback"
|
||||
OAUTH_PROVIDER = "pocket-id"
|
||||
OAUTH_PROVIDER_DOMAIN = "pocket-id"
|
||||
OAUTH_AUTHORIZATION_URL = "https://${poCfg.subdomain}.${domain}/authorize"
|
||||
@@ -67,11 +68,11 @@ in
|
||||
CLIENT_SSO_VIA_LOCAL_BROWSER = True
|
||||
|
||||
ENABLE_SEADOC = True
|
||||
SEADOC_SERVER_URL = "https://${rootCfg.server.subdomain}.${domain}/sdoc-server"
|
||||
SEADOC_SERVER_URL = "https://${moduleCfg.server.subdomain}.${domain}/sdoc-server"
|
||||
|
||||
OFFICE_SERVER_TYPE = "CollaboraOffice"
|
||||
ENABLE_OFFICE_WEB_APP = True
|
||||
OFFICE_WEB_APP_BASE_URL = "http://${rootCfg.collabora.name}:9980/hosting/discovery"
|
||||
OFFICE_WEB_APP_BASE_URL = "http://${moduleCfg.collabora.name}:9980/hosting/discovery"
|
||||
WOPI_ACCESS_TOKEN_EXPIRATION = 10 * 60 * 60
|
||||
OFFICE_WEB_APP_FILE_EXTENSION = (
|
||||
"odp", "ods", "odt",
|
||||
@@ -95,12 +96,12 @@ in
|
||||
".${domain}" ,
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
"${rootCfg.server.name}",
|
||||
"${moduleCfg.server.name}",
|
||||
]
|
||||
CSRF_COOKIE_SECURE = True
|
||||
CSRF_COOKIE_SAMESITE = "Lax"
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
"https://${rootCfg.server.subdomain}.${domain}"
|
||||
"https://${moduleCfg.server.subdomain}.${domain}"
|
||||
]
|
||||
'';
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.server;
|
||||
rootCfg = config.selfhosted;
|
||||
common = rootCfg.common;
|
||||
moduleCfg = rootCfg.seafile;
|
||||
cfg = moduleCfg.server;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -21,7 +22,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf rootCfg.enable {
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/seafile-mc:13.0-latest";
|
||||
ports = [
|
||||
@@ -41,15 +42,15 @@ in
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${moduleCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.redis.name}.service"
|
||||
"${common.backend}-${moduleCfg.mariadb.name}.service"
|
||||
"${common.backend}-${moduleCfg.redis.name}.service"
|
||||
];
|
||||
preStart = ''
|
||||
mkdir -p ${hostDataPath}/server/shared/seafile/conf
|
||||
|
||||
Reference in new issue
Block a user