Unverified Commit 4005a14f authored by Maximilian Bosch's avatar Maximilian Bosch
Browse files

nixos/lasuite-docs: perform migrations after generating secret key

When generating the key inside the module rather than specifying a
hard-coded one, you'd get an error like this otherwise

    Jul 15 16:02:53 nixos systemd[1]: Starting Docs from SuiteNumérique...
    [...]
    Jul 15 16:02:54 nixos lasuite-docs-pre-start[19466]: ValueError: Couldn't setup configuration 'impress.settings.Production':  Path '/var/lib/lasuite-docs/django_secret_key' does not exist.
parent 07e8255e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -362,10 +362,6 @@ in
          touch .version
        fi

        if [ "${cfg.backendPackage.version}" != "$(cat .version)" ]; then
          ${getExe cfg.backendPackage} migrate
          echo -n "${cfg.backendPackage.version}" > .version
        fi
        ${optionalString (cfg.secretKeyPath == null) ''
          if [[ ! -f /var/lib/lasuite-docs/django_secret_key ]]; then
            (
@@ -374,6 +370,10 @@ in
            )
          fi
        ''}
        if [ "${cfg.backendPackage.version}" != "$(cat .version)" ]; then
          ${getExe cfg.backendPackage} migrate
          echo -n "${cfg.backendPackage.version}" > .version
        fi
      '';

      environment = pythonEnvironment;