Set the script to look for its config in its directory
This commit is contained in:
parent
98ea6b444a
commit
1ec79191d8
1 changed files with 5 additions and 2 deletions
|
|
@ -13,8 +13,11 @@ except ImportError:
|
||||||
verbose = True
|
verbose = True
|
||||||
action = "open" # open, close, status
|
action = "open" # open, close, status
|
||||||
|
|
||||||
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
config_path = SCRIPT_DIR + '/config.yaml'
|
||||||
|
|
||||||
# If no config exists we create one
|
# If no config exists we create one
|
||||||
if not os.path.exists("config.yaml"):
|
if not os.path.exists(config_path):
|
||||||
print("No config file detected, populating one")
|
print("No config file detected, populating one")
|
||||||
dummy_config = """dummy-service:
|
dummy_config = """dummy-service:
|
||||||
description: "Dummy service to change"
|
description: "Dummy service to change"
|
||||||
|
|
@ -26,7 +29,7 @@ config_data = ""
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print("Reading the config")
|
print("Reading the config")
|
||||||
with open("config.yaml", "r", encoding="utf8") as config_file:
|
with open(config_path, "r", encoding="utf8") as config_file:
|
||||||
config_data = config_file.read()
|
config_data = config_file.read()
|
||||||
|
|
||||||
if not config_data:
|
if not config_data:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue