refactor(infra): flatten traefik environment configuration
This commit simplifies infrastructure code by reducing unnecessary abstraction, making the resulting environment configuration easier to maintain and audit. - Eliminate intermediate variable sets and the merge (//) operator in `traefik-deployments.nix`. - Pass a direct attribute set to `lib.generators.toKeyValue` for clearer, linear configuration. - Preserve logical grouping using native Nix comments.
This commit is contained in:
1 parent
cdb8a0d804
commit
19f373289c
1 file changed
+10
-30
@@ -23,24 +23,21 @@
|
||||
# Generate the unified environment file at runtime in /run/secrets/traefik-deployments.env
|
||||
sops.templates."traefik-deployments.env" = {
|
||||
owner = "kiskaadee";
|
||||
content = let
|
||||
coreConfig = {
|
||||
content = lib.generators.toKeyValue {} {
|
||||
# --- Core / Infrastructure Settings ---
|
||||
PROXY_NETWORK = "proxy-net";
|
||||
CERT_RESOLVER = "myresolver";
|
||||
DOMAIN_SUFFIX = "arch-services.mywire.org";
|
||||
};
|
||||
|
||||
excalidrawConfig = {
|
||||
# --- Excalidraw ---
|
||||
EXCALIDRAW_DOMAIN = "excalidraw.arch-services.mywire.org";
|
||||
};
|
||||
|
||||
giteaConfig = {
|
||||
# --- Gitea ---
|
||||
GITEA_DOMAIN = "gitea.arch-services.mywire.org";
|
||||
GITEA_SSH_DOMAIN = "gitea.arch-services.mywire.org";
|
||||
GITEA_AUTH_MIDDLEWARE = "https-redirect@docker";
|
||||
};
|
||||
|
||||
jellyfinConfig = {
|
||||
# --- Jellyfin ---
|
||||
JELLYFIN_SERVICE_NAME = "jellyfin";
|
||||
JELLYFIN_CONTAINER_NAME = "jellyfin";
|
||||
JELLYFIN_IMAGE_TAG = "latest";
|
||||
@@ -53,9 +50,8 @@
|
||||
JELLYFIN_HTTPS_ENTRYPOINT = "websecure";
|
||||
JELLYFIN_RATE_LIMIT_AVG = "100";
|
||||
JELLYFIN_RATE_LIMIT_BURST = "50";
|
||||
};
|
||||
|
||||
learningConfig = {
|
||||
# --- Learning Dashboard ---
|
||||
LEARNING_SERVICE_NAME = "learning-hub";
|
||||
LEARNING_DOMAIN = "learning.arch-services.mywire.org";
|
||||
LEARNING_APP_PORT = "8000";
|
||||
@@ -63,43 +59,27 @@
|
||||
LEARNING_DOCKER_HOST = "tcp://socket-proxy:2375";
|
||||
TURSO_DATABASE_URL = config.sops.placeholder.learning_turso_db_url;
|
||||
TURSO_AUTH_TOKEN = config.sops.placeholder.learning_turso_auth_token;
|
||||
};
|
||||
|
||||
mermaidConfig = {
|
||||
# --- Mermaid ---
|
||||
MERMAID_DOMAIN = "mermaid.arch-services.mywire.org";
|
||||
MERMAID_SERVICE_NAME = "mermaid";
|
||||
};
|
||||
|
||||
mongoConfig = {
|
||||
# --- MongoDB ---
|
||||
MONGO_ROOT_USERNAME = config.sops.placeholder.mongo_root_username;
|
||||
MONGO_ROOT_PASSWORD = config.sops.placeholder.mongo_root_password;
|
||||
MONGO_DOMAIN = "mongodb.arch-services.mywire.org";
|
||||
};
|
||||
|
||||
postgresConfig = {
|
||||
# --- PostgreSQL ---
|
||||
POSTGRES_USER = config.sops.placeholder.postgres_user;
|
||||
POSTGRES_PASSWORD = config.sops.placeholder.postgres_password;
|
||||
POSTGRES_DB = config.sops.placeholder.postgres_db;
|
||||
POSTGRES_DOMAIN = "pgsql.arch-services.mywire.org";
|
||||
};
|
||||
|
||||
ollamaConfig = {
|
||||
# --- Ollama ---
|
||||
OLLAMA_DOMAIN = "ollama.arch-services.mywire.org";
|
||||
OLLAMA_API_KEY = config.sops.placeholder.ollama_api_key;
|
||||
OLLAMA_REPLICAS = "1";
|
||||
OLLAMA_DATA_VOLUME = "ollama_data";
|
||||
};
|
||||
|
||||
allConfig = coreConfig
|
||||
// excalidrawConfig
|
||||
// giteaConfig
|
||||
// jellyfinConfig
|
||||
// learningConfig
|
||||
// mermaidConfig
|
||||
// mongoConfig
|
||||
// postgresConfig
|
||||
// ollamaConfig;
|
||||
in
|
||||
lib.generators.toKeyValue {} allConfig;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user