matrix-synapse: create with utf-8 encoding
This commit is contained in:
parent
6dec2a9222
commit
2a0019457d
|
@ -81,30 +81,14 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.matrix-synapse.serviceConfig.ExecStartPre = [
|
clan.postgresql.users.matrix-synapse = { };
|
||||||
"+${pkgs.writeShellScript "create-matrix-synapse-db" ''
|
clan.postgresql.databases.matrix-synapse.create.options = {
|
||||||
export PATH=${
|
TEMPLATE = "template0";
|
||||||
lib.makeBinPath [
|
LC_COLLATE = "C";
|
||||||
config.services.postgresql.package
|
LC_CTYPE = "C";
|
||||||
pkgs.util-linux
|
ENCODING = "UTF8";
|
||||||
pkgs.gnugrep
|
OWNER = "matrix-synapse";
|
||||||
]
|
};
|
||||||
}
|
|
||||||
psql() { runuser -u postgres -- psql "$@"; }
|
|
||||||
# wait for postgres to be ready
|
|
||||||
while ! runuser -u postgres pg_isready; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
if ! psql -tAc "SELECT 1 FROM pg_database WHERE datname = 'matrix-synapse'" | grep -q 1; then
|
|
||||||
psql -c "CREATE DATABASE \"matrix-synapse\" TEMPLATE template0 LC_COLLATE = 'C' LC_CTYPE = 'C'"
|
|
||||||
fi
|
|
||||||
# create user if it doesn't exist and make it owner of the database
|
|
||||||
if ! psql -tAc "SELECT 1 FROM pg_user WHERE usename = 'matrix-synapse'" | grep -q 1; then
|
|
||||||
psql -c "CREATE USER \"matrix-synapse\""
|
|
||||||
psql -c "ALTER DATABASE \"matrix-synapse\" OWNER TO \"matrix-synapse\""
|
|
||||||
fi
|
|
||||||
''}"
|
|
||||||
];
|
|
||||||
|
|
||||||
clanCore.facts.services."matrix-synapse" = {
|
clanCore.facts.services."matrix-synapse" = {
|
||||||
secret."synapse-registration_shared_secret" = { };
|
secret."synapse-registration_shared_secret" = { };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user