Commit 2fbbb5ab authored by Jiahang Chen's avatar Jiahang Chen
Browse files

change the config data output root

parent 51f9806a
......@@ -13,6 +13,7 @@
from s3i import IdentityProvider
from ml.app_logger import APP_LOGGER
from ml.authentication import GRANT_TYPES
from path.path import PROJECT_ROOT
IDENTITY_PROVIDER_URL = "https://idp.s3i.vswf.dev/"
......@@ -295,7 +296,7 @@ def dir_name_to_default_endpoints(idp, name):
return endpoint
def make_sub_thing(name, roles, id="", features=[]):
def make_sub_thing(name, roles, features=[]):
sub_thing = {
"class": "ml40::Thing",
"name": name,
......@@ -332,20 +333,20 @@ def make_thing_config(dt_id, name, roles, features=[]):
}
}
cwd = os.getcwd()
path = os.path.join(cwd, "configs", "config_{}.json".format(name))
path = os.path.join(PROJECT_ROOT, "configs", "{}.json".format(name))
with open(path, 'wb') as file:
file.write(json.dumps(config_file).encode('utf-8'))
return "config_{}.json".format(name)
return "{}.json".format(name)
def load_config(config_filepath):
def load_config(config_file_name):
"""Creates a json object from a json formatted file found at config_filepath.
:param config_filepath: Path to json formatted file.
"""
with open(config_filepath) as config_file:
config_file_path = os.path.join(PROJECT_ROOT, "configs", config_file_name)
with open(config_file_path) as config_file:
config = json.load(config_file)
return config
......
Supports Markdown
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