def list_and_import_gnc_modules(app, mod_path=GNC_EXTERNAL_MODULE): """ Get all the module enabled from gn_commons.t_modules """ # with app.app_context(): # data = db.session.query(TModules).filter( # TModules.active_backend == True # ) # enabled_modules = [d.as_dict()['module_name'] for d in data] # iter over external_modules dir # and import only modules which are enabled for f in mod_path.iterdir(): if f.is_dir(): conf_manifest = load_toml(str(f / "manifest.toml")) module_name = conf_manifest["module_name"] module_path = Path(GNC_EXTERNAL_MODULE / module_name) module_parent_dir = str(module_path.parent) module_name = "{}.config.conf_schema_toml".format(module_path.name) sys.path.insert(0, module_parent_dir) module = __import__(module_name, globals=globals()) module_name = "{}.backend.blueprint".format(module_path.name) module_blueprint = __import__(module_name, globals=globals()) sys.path.pop(0) conf_module = load_toml(str(f / "config/conf_gn_module.toml")) print(conf_module, conf_manifest, module_blueprint) yield conf_module, conf_manifest, module_blueprint
def load_config(config_file=None): """ Load the geonature-citizen configuration from a given file""" config_gnc = load_toml(get_config_file_path()) config_gnc["FLASK_ADMIN_FLUID_LAYOUT"] = True config_gnc["MAPBOX_MAP_ID"] = "light-v10" config_gnc["DEFAULT_CENTER_LAT"] = 5 config_gnc["DEFAULT_CENTER_LONG"] = 45 # if not "MAPBOX_MAP_ID" in config_gnc: # print("MAPBOXID") # config_gnc["MAPBOX_MAP_ID"] = "light-v10" return config_gnc
def load_config(config_file=None): """ Load the geonature-citizen configuration from a given file""" config_gnc = load_toml(get_config_file_path()) return config_gnc