···
PAPERCLIP_ROOT_PATH = "/var/lib/mastodon/public-system";
PAPERCLIP_ROOT_URL = "/system";
ES_ENABLED = if (cfg.elasticsearch.host != null) then "true" else "false";
33
-
ES_HOST = cfg.elasticsearch.host;
34
-
ES_PORT = toString(cfg.elasticsearch.port);
TRUSTED_PROXY_IP = cfg.trustedProxy;
// lib.optionalAttrs (cfg.database.host != "/run/postgresql" && cfg.database.port != null) { DB_PORT = toString cfg.database.port; }
// lib.optionalAttrs cfg.smtp.authenticate { SMTP_LOGIN = cfg.smtp.user; }
38
+
// lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_HOST = cfg.elasticsearch.host; }
39
+
// lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_PORT = toString(cfg.elasticsearch.port); }
40
+
// lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_PRESET = cfg.elasticsearch.preset; }
41
+
// lib.optionalAttrs (cfg.elasticsearch.user != null) { ES_USER = cfg.elasticsearch.user; }
systemCallsList = [ "@cpu-emulation" "@debug" "@keyring" "@ipc" "@mount" "@obsolete" "@privileged" "@setuid" ];
···
519
+
preset = lib.mkOption {
520
+
description = lib.mdDoc ''
521
+
It controls the ElasticSearch indices configuration (number of shards and replica).
523
+
type = lib.types.enum [ "single_node_cluster" "small_cluster" "large_cluster" ];
524
+
default = "single_node_cluster";
525
+
example = "large_cluster";
528
+
user = lib.mkOption {
529
+
description = lib.mdDoc "Used for optionally authenticating with Elasticsearch.";
530
+
type = lib.types.nullOr lib.types.str;
532
+
example = "elasticsearch-mastodon";
535
+
passwordFile = lib.mkOption {
536
+
description = lib.mdDoc ''
537
+
Path to file containing password for optionally authenticating with Elasticsearch.
539
+
type = lib.types.nullOr lib.types.path;
541
+
example = "/var/lib/mastodon/secrets/elasticsearch-password";
···
DB_PASS="$(cat ${cfg.database.passwordFile})"
'' + lib.optionalString cfg.smtp.authenticate ''
SMTP_PASSWORD="$(cat ${cfg.smtp.passwordFile})"
695
+
'' + lib.optionalString (cfg.elasticsearch.passwordFile != null) ''
696
+
ES_PASS="$(cat ${cfg.elasticsearch.passwordFile})"