add dbUrl
This commit is contained in:
parent
748f956361
commit
d6db331166
1 changed files with 15 additions and 1 deletions
16
flake.nix
16
flake.nix
|
|
@ -69,6 +69,18 @@
|
||||||
description = "The phoenix package containing the application";
|
description = "The phoenix package containing the application";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
secret_key_file = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
example = "/var/lib/skey";
|
||||||
|
description = "The Secrert key for Phoenix";
|
||||||
|
};
|
||||||
|
|
||||||
|
dbUrl = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "postgresql://${config.services.postgres.user}:${config.services.postgres.password}@${config.services.postgres.host}:${toString config.services.postgres.port}/zoeyscomputer_prod";
|
||||||
|
description = "Postgres Databaase URL";
|
||||||
|
};
|
||||||
|
|
||||||
enableServer = mkOption rec {
|
enableServer = mkOption rec {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
|
@ -105,6 +117,7 @@
|
||||||
PORT = "${toString cfg.phx.port}";
|
PORT = "${toString cfg.phx.port}";
|
||||||
PHX_HOST = cfg.domain;
|
PHX_HOST = cfg.domain;
|
||||||
PHX_SERVER = toString cfg.phx.enableServer;
|
PHX_SERVER = toString cfg.phx.enableServer;
|
||||||
|
DATABASE_URL = cfg.phx.dbUrl;
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "exec";
|
Type = "exec";
|
||||||
|
|
@ -113,6 +126,7 @@
|
||||||
# Implied by DynamicUser, but just to emphasize due to RELEASE_TMP
|
# Implied by DynamicUser, but just to emphasize due to RELEASE_TMP
|
||||||
PrivateTmp = true;
|
PrivateTmp = true;
|
||||||
ExecStart = pkgs.writeShellScript "start-zoeycomputer" ''
|
ExecStart = pkgs.writeShellScript "start-zoeycomputer" ''
|
||||||
|
export SECRET_KEY_BASE=$(cat ${cfg.phx.secret_key_file})
|
||||||
${cfg.phx.package}/bin/${release_name} eval "ZoeysComputer.Release.migrate"
|
${cfg.phx.package}/bin/${release_name} eval "ZoeysComputer.Release.migrate"
|
||||||
${cfg.phx.package}/bin/${release_name} start
|
${cfg.phx.package}/bin/${release_name} start
|
||||||
'';
|
'';
|
||||||
|
|
@ -128,7 +142,7 @@
|
||||||
StartLimitInterval = 10;
|
StartLimitInterval = 10;
|
||||||
};
|
};
|
||||||
# disksup requires bash
|
# disksup requires bash
|
||||||
path = [pkgs.bash];
|
path = [pkgs.bash pkgs.coreutils];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue