diff options
author | Izorkin <izorkin@elven.pw> | 2023-10-21 22:42:47 +0300 |
---|---|---|
committer | Kerstin <kerstin@erictapen.name> | 2023-11-15 14:01:47 +0100 |
commit | 63ed35dac4f0bd0cdd63bf257e0e759efdafae7a (patch) | |
tree | 7181428803004cb86fcbec8b9c7f0d8a51119cc1 /nixos/modules | |
parent | c5322227c7c8ba8987c544d7a6e51856073c5f1a (diff) | |
download | nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar.gz nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar.bz2 nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar.lz nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar.xz nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.tar.zst nixpkgs-63ed35dac4f0bd0cdd63bf257e0e759efdafae7a.zip |
nixos/mastodon: update elasticsearch configuration
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/web-apps/mastodon.nix | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix index ff261fdefb8..d861f9e251b 100644 --- a/nixos/modules/services/web-apps/mastodon.nix +++ b/nixos/modules/services/web-apps/mastodon.nix @@ -30,13 +30,15 @@ let PAPERCLIP_ROOT_PATH = "/var/lib/mastodon/public-system"; PAPERCLIP_ROOT_URL = "/system"; ES_ENABLED = if (cfg.elasticsearch.host != null) then "true" else "false"; - ES_HOST = cfg.elasticsearch.host; - 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; } + // lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_HOST = cfg.elasticsearch.host; } + // lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_PORT = toString(cfg.elasticsearch.port); } + // lib.optionalAttrs (cfg.elasticsearch.host != null) { ES_PRESET = cfg.elasticsearch.preset; } + // lib.optionalAttrs (cfg.elasticsearch.user != null) { ES_USER = cfg.elasticsearch.user; } // cfg.extraConfig; systemCallsList = [ "@cpu-emulation" "@debug" "@keyring" "@ipc" "@mount" "@obsolete" "@privileged" "@setuid" ]; @@ -513,6 +515,31 @@ in { type = lib.types.port; default = 9200; }; + + preset = lib.mkOption { + description = lib.mdDoc '' + It controls the ElasticSearch indices configuration (number of shards and replica). + ''; + type = lib.types.enum [ "single_node_cluster" "small_cluster" "large_cluster" ]; + default = "single_node_cluster"; + example = "large_cluster"; + }; + + user = lib.mkOption { + description = lib.mdDoc "Used for optionally authenticating with Elasticsearch."; + type = lib.types.nullOr lib.types.str; + default = null; + example = "elasticsearch-mastodon"; + }; + + passwordFile = lib.mkOption { + description = lib.mdDoc '' + Path to file containing password for optionally authenticating with Elasticsearch. + ''; + type = lib.types.nullOr lib.types.path; + default = null; + example = "/var/lib/mastodon/secrets/elasticsearch-password"; + }; }; package = lib.mkOption { @@ -665,6 +692,8 @@ in { DB_PASS="$(cat ${cfg.database.passwordFile})" '' + lib.optionalString cfg.smtp.authenticate '' SMTP_PASSWORD="$(cat ${cfg.smtp.passwordFile})" + '' + lib.optionalString (cfg.elasticsearch.passwordFile != null) '' + ES_PASS="$(cat ${cfg.elasticsearch.passwordFile})" '' + '' EOF ''; |