Skip to content

Commit

Permalink
feat: added redis unix socket support
Browse files Browse the repository at this point in the history
  • Loading branch information
bddvlpr committed Jan 28, 2024
1 parent 504447d commit bd1bc16
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ UNTIS_USERNAME=
UNTIS_PASSWORD=
UNTIS_BASEURL=

BULL_REDIS_HOST=
BULL_REDIS_PORT=
BULL_REDIS_HOST=localhost
BULL_REDIS_PORT=6379
# or
#BULL_REDIS_PATH=/run/redis/redis.sock

#MAINTENANCE_TITLE=
#MAINTENANCE_DESCRIPTION=
Expand Down
4 changes: 3 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mkYarnPackage rec {

offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-NHghkf5Nziyz3M7E4941sV5JFqY7RYMTlZqYsQPZLpU=";
hash = "sha256-mToEmc4cNd2fsyT/DUkzMiO4BYUDw6aexbcXOVfB2ds=";
};

nativeBuildInputs = [makeWrapper];
Expand All @@ -30,6 +30,8 @@ mkYarnPackage rec {
--add-flags "$out/libexec/untis-ics-sync/deps/untis-ics-sync/dist/main.js"
'';

dontStrip = true;

meta = with lib; {
description = "Serves a calendar API (ICS) for events provided from Untis";
homepage = "https://github.com/bddvlpr/untis-ics-sync";
Expand Down
8 changes: 8 additions & 0 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,20 @@ in {
serviceConfig = {
Restart = "on-failure";
ExecStart = "${lib.getExe cfg.package}";
Environment = [
"BULL_REDIS_PATH=${config.services.redis.servers.untis-ics-sync.unixSocket}"
];
EnvironmentFile = cfg.envFile;
User = cfg.user;
Group = cfg.group;
};
};

services.redis.servers.untis-ics-sync = {
enable = true;
user = cfg.user;
};

users = {
users.untis-ics-sync = lib.mkIf (cfg.user == "untis-ics-sync") {
isSystemUser = true;
Expand Down
1 change: 1 addition & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { BullModule } from '@nestjs/bull';
redis: {
host: configService.get<string>('BULL_REDIS_HOST'),
port: configService.get<number>('BULL_REDIS_PORT'),
path: configService.get<string>('BULL_REDIS_PATH'),
},
}),
}),
Expand Down

0 comments on commit bd1bc16

Please sign in to comment.