mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
nixos/lemmy: only use env var when instructed
Lemmy checks the environment variable before the configuration file; i.e. if the file is used to configure the database but the environment variable is set to anything, the connection will fail because it'll ignore the file. This was the previous behavior. Now, the environment variable will be unset unless the user explicitly chooses to set it, which makes the file-based configuration function correctly. It's also possible to manually set the environment variable, which has the major advantage of working around [this issue][0], which prevents certain setups from working. [0]: https://github.com/LemmyNet/lemmy/issues/2945
This commit is contained in:
parent
dd0b5a7e08
commit
b1853ecfcd
@ -27,7 +27,15 @@ in
|
||||
caddy.enable = mkEnableOption (lib.mdDoc "exposing lemmy with the caddy reverse proxy");
|
||||
nginx.enable = mkEnableOption (lib.mdDoc "exposing lemmy with the nginx reverse proxy");
|
||||
|
||||
database.createLocally = mkEnableOption (lib.mdDoc "creation of database on the instance");
|
||||
database = {
|
||||
createLocally = mkEnableOption (lib.mdDoc "creation of database on the instance");
|
||||
|
||||
uri = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = lib.mdDoc "The connection URI to use. Takes priority over the configuration file if set.";
|
||||
};
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = { };
|
||||
@ -190,9 +198,7 @@ in
|
||||
|
||||
environment = {
|
||||
LEMMY_CONFIG_LOCATION = "/run/lemmy/config.hjson";
|
||||
|
||||
# Verify how this is used, and don't put the password in the nix store
|
||||
LEMMY_DATABASE_URL = with cfg.settings.database;"postgres:///${database}?host=${host}";
|
||||
LEMMY_DATABASE_URL = mkIf (cfg.database.uri != null) cfg.database.uri;
|
||||
};
|
||||
|
||||
documentation = [
|
||||
|
Loading…
Reference in New Issue
Block a user