mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-01-15 10:48:54 +01:00
Move config.yaml to the root folder of ED
This commit is contained in:
parent
5a643c383b
commit
d023fd07b0
@ -1,10 +1,11 @@
|
||||
import os
|
||||
import argparse
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
# The config file is in the same directory as this script
|
||||
config_directory = os.path.dirname(__file__)
|
||||
config_yaml = os.path.join(config_directory, "config.yaml")
|
||||
config_yaml = os.path.join(config_directory, "..", "config.yaml")
|
||||
config_json = os.path.join(config_directory, "config.json")
|
||||
|
||||
parser = argparse.ArgumentParser(description='Get values from config file')
|
||||
@ -15,6 +16,10 @@ parser.add_argument('key', metavar='key', nargs='+',
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# migrate the old config yaml location
|
||||
config_legacy_yaml = os.path.join(config_directory, "config.yaml")
|
||||
if os.path.isfile(config_legacy_yaml):
|
||||
shutil.move(config_legacy_yaml, config_yaml)
|
||||
|
||||
if os.path.isfile(config_yaml):
|
||||
from ruamel.yaml import YAML
|
||||
|
@ -102,7 +102,13 @@ def init():
|
||||
|
||||
|
||||
def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
||||
config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml")
|
||||
config_yaml_path = os.path.join(CONFIG_DIR, "..", "config.yaml")
|
||||
|
||||
# migrate the old config yaml location
|
||||
config_legacy_yaml = os.path.join(CONFIG_DIR, "config.yaml")
|
||||
if os.path.isfile(config_legacy_yaml):
|
||||
shutil.move(config_legacy_yaml, config_yaml_path)
|
||||
|
||||
if os.path.isfile(config_yaml_path):
|
||||
try:
|
||||
yaml = YAML()
|
||||
@ -143,7 +149,7 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
||||
|
||||
def setConfig(config):
|
||||
try: # config.yaml
|
||||
config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml")
|
||||
config_yaml_path = os.path.join(CONFIG_DIR, "..", "config.yaml")
|
||||
yaml = YAML()
|
||||
|
||||
if not hasattr(config, "_yaml_comment"):
|
||||
|
Loading…
Reference in New Issue
Block a user