Unverified Commit fe0d323a authored by Martin Weinelt's avatar Martin Weinelt
Browse files

nixos/engelsystem: prune template cache on version changes

After upgrading to 3.5.0 we noticed, that registering would redirect to
the login page and not work at all. At the same time the admin user was
unable to access its user settings.

This issue could be tracked back to the template cache, that must be
invalidated between release upgrades.
parent b9459bb5
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -163,7 +163,17 @@ in {
        Group = "engelsystem";
      };
      script = ''
        versionFile="/var/lib/engelsystem/.version"
        version=$(cat "$versionFile" 2>/dev/null || echo 0)

        if [[ $version != ${cfg.package.version} ]]; then
          # prune template cache between releases
          rm -rfv /var/lib/engelsystem/storage/cache/*

          ${cfg.package}/bin/migrate

          echo ${cfg.package.version} > "$versionFile"
        fi
      '';
      after = [ "engelsystem-init.service" "mysql.service" ];
    };