Commit 93e5bce1 authored by Romain Loth's avatar Romain Loth

fixing config logic: its use in the docker-compose and new inipath for server

parent 6d0b9a48
......@@ -17,12 +17,12 @@ API_ROUTE = /api
################################################################################
[services]
# subservice for the comex_shared database
SQL_HOST = 172.17.0.2
# inner address of subservice for the comex_shared database
SQL_HOST = comex_db_backend
SQL_PORT = 3306
# subservice for authentication credentials
# outer address of subservice for authentication credentials
DOORS_HOST = 0.0.0.0
DOORS_PORT = 8989
DOORS_PORT = 80
################################################################################
......@@ -140,6 +140,7 @@ MIN_KW = 5
# -----------------------------------------------------------------------
# /services/user/register
print("register route: ", config['PREFIX'] + config['USR_ROUTE'] + '/register')
@app.route(config['PREFIX'] + config['USR_ROUTE'] + '/register', methods=['GET','POST'])
def register():
if request.method == 'GET':
......
......@@ -13,8 +13,8 @@ CONFIGMENU = [
{"sec": 'main', "var":'COMEX_HOST', "def": '0.0.0.0' },
{"sec": 'main', "var":'COMEX_PORT', "def": '9090' },
{"sec": 'routes', "var":'PREFIX', "def": '/services' },
{"sec": 'routes', "var":'USR_ROUTE', "def": '/user/' },
{"sec": 'routes', "var":'API_ROUTE', "def": '/api/' },
{"sec": 'routes', "var":'USR_ROUTE', "def": '/user' },
{"sec": 'routes', "var":'API_ROUTE', "def": '/api' },
{"sec": 'services', "var":'SQL_HOST', "def": '172.17.0.2' },
{"sec": 'services', "var":'SQL_PORT', "def": '3306' },
{"sec": 'services', "var":'DOORS_HOST', "def": '0.0.0.0' },
......@@ -42,10 +42,12 @@ def read_config():
our_home = home_path()
ini = ConfigParser()
ini.read(path.join(our_home, "parametres_comex.ini"))
inipath = path.join(our_home, "config", "parametres_comex.ini")
ini.read(inipath)
# debug sections
# print("ini sections:", [sec for sec in ini.keys()])
if "main" not in ini:
print("WARNING: the config file at '%s' seems empty, I will use env or default values")
# read ini file and use 2 fallbacks: env or default
for citem in CONFIGMENU:
......@@ -53,6 +55,7 @@ def read_config():
varname = citem['var']
default = citem['def']
is_bool = (type(default) == bool)
if section in ini and varname in ini[section]:
if is_bool:
out_dict[varname] = ini.getboolean(section, varname)
......
......@@ -21,6 +21,7 @@ RUN pip3 install --upgrade pip
# for comex2 itself ----------------------------------------------------------
# pull the comex server from repository
RUN echo "updating git"
RUN git clone https://github.com/moma/comex2.git
# Install project dependencies
......
......@@ -28,11 +28,10 @@
links:
- comex_db_test:comex_db_backend
- doors_test:doors_backend
# links the outside config parametres_comex.ini to the inside
# /!\ this erases the contained config with the outside one /!\
volumes:
- ../../config:/comex2/config
- ../../config/:/comex2/config
# # moved from env vars to new config vars via volume config
# environment:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment