Skip to content

Commit

Permalink
feat: configure root dir using config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Hagg committed May 13, 2021
1 parent 01895bd commit 756b028
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This is specific to this package
config.ini

# This file taken from github/gitignore
# https://github.com/github/gitignore/blob/master/Python.gitignore

Expand Down
11 changes: 10 additions & 1 deletion pyreisejl/utility/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import configparser
import os
from pathlib import Path

DATA_ROOT_DIR = "/mnt/bes/pcm"
INI_FILE = "config.ini"
if Path(INI_FILE).exists():
conf = configparser.ConfigParser()
conf.read(INI_FILE)
for k, v in conf["REISE.jl"].items():
os.environ[k.upper()] = v

DATA_ROOT_DIR = os.getenv("DATA_ROOT_DIR", "/mnt/bes/pcm")

SCENARIO_LIST = os.path.join(DATA_ROOT_DIR, "ScenarioList.csv")
EXECUTE_LIST = os.path.join(DATA_ROOT_DIR, "ExecuteList.csv")
Expand Down

0 comments on commit 756b028

Please sign in to comment.