move historywriter to secop_psi

as historywriter currently could be used at psi only
secop_psi is a better place for it

+ add comment about a general config file

Change-Id: I9b0e74d3da83ac485bd4bcc13475695c3140822c
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25077
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2021-03-01 09:24:20 +01:00
parent 76c6ebe92c
commit 4fd9c17bcb
3 changed files with 12 additions and 1 deletions

View File

@ -52,9 +52,12 @@ else:
# overwrite with env variables SECOP_LOGDIR, SECOP_PIDDIR, SECOP_CONFDIR, if present
for dirname in CONFIG:
CONFIG[dirname] = environ.get('SECOP_%s' % dirname.upper(), CONFIG[dirname])
# this is not customizable
CONFIG['basedir'] = repodir
# TODO: if ever more general options are need, we should think about a general config file
unset_value = object()

View File

@ -275,8 +275,16 @@ class Server:
self.log.info('all modules and pollers started')
history_path = os.environ.get('FRAPPY_HISTORY')
if history_path:
from secop.historywriter import FrappyHistoryWriter # pylint: disable=import-outside-toplevel
from secop_psi.historywriter import FrappyHistoryWriter # pylint: disable=import-outside-toplevel
writer = FrappyHistoryWriter(history_path, PREDEFINED_ACCESSIBLES.keys(), self.dispatcher)
# treat writer as a connection
self.dispatcher.add_connection(writer)
writer.init(self.dispatcher.handle_describe(writer, None, None))
# TODO: if ever somebody wants to implement an other history writer:
# - a general config file /etc/secp/secop.conf or <frappy repo>/etc/secop.conf
# might be introduced, which contains the log, pid and cfg directory path and
# the class path implementing the history
# - or we just add here an other if statement:
# history_path = os.environ.get('ALTERNATIVE_HISTORY')
# if history_path:
# from secop_<xx>.historywriter import ... etc.