48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
"""set configurations"""
|
|
|
|
from configparser import ConfigParser
|
|
|
|
from . import ENV_PARENT_PATH
|
|
|
|
|
|
class Config:
|
|
def __init__(self):
|
|
"""
|
|
Initializes the Config class by reading configuration files.
|
|
It loads settings from 'elab.ini' and 'db.ini' for logging, worker, database, table, tool, and Matlab configurations.
|
|
"""
|
|
|
|
c = ConfigParser()
|
|
c.read([f"{ENV_PARENT_PATH}/env/elab.ini", f"{ENV_PARENT_PATH}/env/db.ini"])
|
|
|
|
# LOG setting
|
|
self.logfilename = c.get("logging", "logFilename")
|
|
|
|
# Worker setting
|
|
self.max_threads = c.getint("threads", "max_num")
|
|
|
|
# DB setting
|
|
self.dbhost = c.get("db", "hostname")
|
|
self.dbport = c.getint("db", "port")
|
|
self.dbuser = c.get("db", "user")
|
|
self.dbpass = c.get("db", "password")
|
|
self.dbname = c.get("db", "dbName")
|
|
self.max_retries = c.getint("db", "maxRetries")
|
|
|
|
# Tables
|
|
self.dbusertable = c.get("tables", "userTableName")
|
|
self.dbrectable = c.get("tables", "recTableName")
|
|
self.dbrawdata = c.get("tables", "rawTableName")
|
|
self.dbrawdata = c.get("tables", "rawTableName")
|
|
self.dbnodes = c.get("tables", "nodesTableName")
|
|
|
|
# Tool
|
|
self.elab_status = list(c.get("tool", "elab_status").split("|"))
|
|
|
|
# Matlab
|
|
self.matlab_runtime = c.get("matlab", "runtime")
|
|
self.matlab_func_path = c.get("matlab", "func_path")
|
|
self.matlab_timeout = c.getint("matlab", "timeout")
|
|
self.matlab_error = c.get("matlab", "error")
|
|
self.matlab_error_path = c.get("matlab", "error_path")
|