28 lines
563 B
Python
28 lines
563 B
Python
|
""" config management """
|
||
|
|
||
|
from os import makedirs, path
|
||
|
import tempfile
|
||
|
|
||
|
current_config = None
|
||
|
|
||
|
class DefaultConfig:
|
||
|
|
||
|
DEBUG = False
|
||
|
SECRET_KEY="toto"
|
||
|
tempdir= path.join(tempfile.gettempdir(), "ITPlanning")
|
||
|
BASE = {
|
||
|
"database_uri": "sqlite:///" + path.join(tempdir, "ITPlanning.db"),
|
||
|
}
|
||
|
def __init__(self):
|
||
|
if not path.exists(self.tempdir):
|
||
|
makedirs(self.tempdir)
|
||
|
current_config = self
|
||
|
|
||
|
|
||
|
|
||
|
def get_current_config():
|
||
|
|
||
|
if current_config is None:
|
||
|
DefaultConfig()
|
||
|
return current_config
|