ragflow/python/util/config.py
KevinHuSh 1eb186a25f go through smoke test of all API (#12)
* add field progress msg into docinfo; add file processing procedure

* go through upload, create kb, add doc to kb

* smoke test for all API

* smoke test for all API
2023-12-22 17:57:27 +08:00

24 lines
662 B
Python
Executable File

from configparser import ConfigParser
import os,inspect
CF = ConfigParser()
__fnm = os.path.join(os.path.dirname(__file__), '../conf/sys.cnf')
if not os.path.exists(__fnm):__fnm = os.path.join(os.path.dirname(__file__), '../../conf/sys.cnf')
assert os.path.exists(__fnm), f"【EXCEPTION】can't find {__fnm}." + os.path.dirname(__file__)
if not os.path.exists(__fnm): __fnm = "./sys.cnf"
CF.read(__fnm)
class Config:
def __init__(self, env):
self.env = env
if env == "spark":CF.read("./cv.cnf")
def get(self, key, default=None):
global CF
return CF[self.env].get(key, default)
def init(env):
return Config(env)