Unverified Commit 1e746f00 authored by Maximilian Bosch's avatar Maximilian Bosch Committed by GitHub
Browse files

Merge: nixos/postgresql: escape initdbArgs (#345341)

parents d5908353 11d1f877
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -569,6 +569,8 @@

- `restic` module now has an option for inhibiting system sleep while backups are running, defaulting to off (not inhibiting sleep), available as [`services.restic.backups.<name>.inhibitsSleep`](#opt-services.restic.backups._name_.inhibitsSleep).

- The arguments from [](#opt-services.postgresql.initdbArgs) now get shell-escaped.

- Support for *runner registration tokens* has been [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/380872)
  in `gitlab-runner` 15.6 and is expected to be removed in `gitlab-runner` 18.0. Configuration of existing runners
  should be changed to using *runner authentication tokens* by configuring
+2 −2
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ $ nix-instantiate --eval -A postgresql_13.psqlSchema
```
For an upgrade, a script like this can be used to simplify the process:
```nix
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
  environment.systemPackages = [
    (let
@@ -211,7 +211,7 @@ For an upgrade, a script like this can be used to simplify the process:

      install -d -m 0700 -o postgres -g postgres "$NEWDATA"
      cd "$NEWDATA"
      sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" ${builtins.concatStringsSep " " cfg.initdbArgs}
      sudo -u postgres $NEWBIN/initdb -D "$NEWDATA" ${lib.escapeShellArgs cfg.initdbArgs}

      sudo -u postgres $NEWBIN/pg_upgrade \
        --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ let
    concatStringsSep
    const
    elem
    escapeShellArgs
    filterAttrs
    isString
    literalExpression
@@ -545,7 +546,7 @@ in
              rm -f ${cfg.dataDir}/*.conf

              # Initialise the database.
              initdb -U ${cfg.superUser} ${concatStringsSep " " cfg.initdbArgs}
              initdb -U ${cfg.superUser} ${escapeShellArgs cfg.initdbArgs}

              # See postStart!
              touch "${cfg.dataDir}/.first_startup"