File size: 802 Bytes
5bfdfae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os.path

from pages.main_page import init_pages
from vector_db.vector_db_client import VectorDB
import configparser

CONFIG_MAP = {}
CONFIG_FILE = "conf/config.ini"


def init_config():
    print(f"init configs {CONFIG_FILE}")
    if not os.path.exists(CONFIG_FILE):
        raise FileNotFoundError(f'The config file {CONFIG_FILE} not found.')

    conf = configparser.ConfigParser()
    conf.read(CONFIG_FILE, encoding="UTF-8")

    for selection in conf.sections():
        for k, v in conf.items(selection):
            CONFIG_MAP[f'{selection}.{k}'] = v


if __name__ == "__main__":
    init_config()
    vdb = VectorDB(CONFIG_MAP)

    server_name = CONFIG_MAP.get('server.name')
    server_port = int(CONFIG_MAP.get('server.port'))
    init_pages(vdb, server_name, server_port,CONFIG_MAP)