38 lines
1.2 KiB
Python
38 lines
1.2 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 'send.ini' and 'db.ini' for logging, worker, database, and table configurations.
|
|
"""
|
|
|
|
c = ConfigParser()
|
|
c.read([f"{ENV_PARENT_PATH}/env/send.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")
|