Only use ID from original ccnet.conf and generate the rest oneself

This commit is contained in:
Trolli Schmittlauch 2019-10-16 23:30:00 +02:00
parent 929eb447a4
commit 9420e101b5

View file

@ -102,6 +102,17 @@ in
description = "listening http port for Seahub web interface";
};
externalPort = mkOption {
type = types.int;
default = 443;
description = "external port under which Seahub is reachable from the outside. Possibly the external port of a reverse proxy like nginx.";
};
enableTLS = mkEnableOption {
default = true;
description = "whether to use TLS and HTTPS for communication";
};
openFirewall = mkEnableOption {
default = true;
description = "whether to open up the firewall ports for ccnet, seafile-server and seahub";
@ -140,11 +151,19 @@ in
${pkgs.seafile-server.ccnet-server}/bin/ccnet-init -c ./conf -n 'TEMPLATENAME' -H 'TEMPLATEHOST' -P 'TEMPLATEPORT'
mv ./conf/ccnet.conf{,.template}
fi
# substitute actual config values to template and symlink config file
${pkgs.gnused}/bin/sed -e 's|TEMPLATENAME|${cfg.name}|g; s|TEMPLATEHOST|${cfg.domainName}|; s|TEMPLATEPORT|${toString cfg.ccnetPort}|' ./conf/ccnet.conf.template > ./conf/ccnet.conf
# generate actual ccnet config file
echo "[General]" > ./conf/ccnet.conf
grep "^ID =" ./conf/ccnet.conf.template >> ./conf/ccnet.conf
echo 'USER_NAME = ${cfg.name}
NAME = ${cfg.name}
# outside URL
SERVICE_URL = http${if cfg.enableTLS then "s" else ""}://${cfg.domainName}:${toString cfg.externalPort}
[Network]
Port = ${toString cfg.ccnetPort}' >> ./conf/ccnet.conf
ln -s ${pkgs.seafile-server} seafile-server
#${pkgs.seafile-server.ccnet-server}/bin/ccnet-init -c ./ccnet -H "${cfg.domainName}" -P ${toString cfg.ccnetPort} -n "${cfg.name}"
./seafile-server/seafile-server-latest/bin/seafile-admin setup
''}")
];