From a863a2b27902d2d8b87dae07c03f94e96d06d92b Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 9 Jul 2023 01:39:58 +0300 Subject: Implement Postgres backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A single giga-commit that took me weeks to produce. I know, this is not exactly the best thing ever — but I wanted to experiment first before "committing" to the implementation, so that I would produce the best solution. --- configuration.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'configuration.nix') diff --git a/configuration.nix b/configuration.nix index b3b7ada..937b1c8 100644 --- a/configuration.nix +++ b/configuration.nix @@ -44,8 +44,9 @@ in { example = "redis://192.168.1.200:6379"; description = lib.mdDoc '' Set the backend used for storing data. Available backends are: - - `file://` - static folder backend (recommended) - - `redis://` - Redis backend (currently unavailable) + - `postgres://` - PostgreSQL backend (recommended) + - `file://` - static folder backend + - `redis://` - Redis backend (currently unavailable) Make sure that if you are using the file backend, the state directory is accessible by Kittybox. By default, the unit config @@ -114,6 +115,12 @@ in { }; }; config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = lib.strings.hasPrefix cfg.backendUri "postgres://" -> cfg.package.hasPostgres; + message = "To use the Postgres backend, Kittybox has to be compiled with Postgres support enabled."; + } + ]; systemd.services.kittybox = { description = "An IndieWeb-enabled blog engine"; -- cgit 1.4.1