Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_additional_conf():
sys.warn("mirage.config.load_additional_conf will be deprecated on next version.", PendingDeprecationWarning)
with open("Miragefile.addon", "r") as djfile:
try:
return yaml.load(djfile)
except:
raise Exception
def load_miragefile():
sys.warn("mirage.config.load_miragefile will be deprecated on next version.", PendingDeprecationWarning)
with open("Miragefile", "r") as djfile:
try:
return json.load(djfile)
except:
raise Exception
def get_all_config():
sys.warn("mirage.config.get_all_config will be deprecated on next version.", PendingDeprecationWarning)
return load_miragefile()
def get_proj_config(conf_name):
sys.warn("mirage.config.get_proj_config will be deprecated on next version.", PendingDeprecationWarning)
try:
data = load_miragefile()
if os.path.exists("Miragefile.addon"): additional = load_additional_conf()
elif os.path.exists("Miragefile.secret"): secret = load_secret_conf()
except:
return "Invalid Miragefile"
if conf_name == "all":
return data
elif conf_name == "name":
return data["project"]["name"]
elif conf_name == "version":
return data["project"]["version"]
def load_miragefile():
sys.warn("mirage.config.load_miragefile will be deprecated on next version.", PendingDeprecationWarning)
with open("Miragefile", "r") as djfile:
try:
return yaml.load(djfile)
except:
raise Exception
def get_django_config(conf_name):
sys.warn("mirage.config.get_django_config will be deprecated on next version.", PendingDeprecationWarning)
try:
data = load_miragefile()
except:
return "Invalid Miragefile"
if conf_name == "path":
if data["django"]["path"] == ".": return os.getcwd()
else: return data["django"]["path"]
elif conf_name == "package":
return data["django"]["package"]
elif conf_name == "database":
return data["django"]["database"]
def get_django_config(conf_name):
sys.warn("mirage.config.get_django_config will be deprecated on next version.", PendingDeprecationWarning)
try:
data = load_miragefile()
except:
return "Invalid Miragefile"
if conf_name == "path":
if data["django"]["path"] == ".": return os.getcwd()
else: return data["django"]["path"]
elif conf_name == "package":
return data["django"]["package"]
elif conf_name == "database":
return data["django"]["database"]
def load_secret_conf():
sys.warn("mirage.config.load_secret_conf will be deprecated on next version.", PendingDeprecationWarning)
with open("Miragefile.secret", "r") as djfile:
try:
return yaml.load(djfile)
except:
raise Exception