-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
61 lines (41 loc) · 1.16 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -------------------
# Daemon settings
# Listening port
PORT = 4999
# Path for YAML files ingested by Prometheus file SD. If path doesn't exists, it will be recursively created.
PROMETHEUS_YAML_DIR = "yaml"
# Database
DATABASE = "targets.db"
# Logging
LOG_FILE = "promsd.log"
LOG_LEVEL = "DEBUG"
DEBUG = True
# logging.basicConfig(
# filename=LOG_FILE,
# level=logging.INFO,
# format='%(levelname)s: %(asctime)s pid:%(process)s module:%(module)s %(message)s',
# datefmt='%d/%m/%y %H:%M:%S',
# )
# --------------------------------------
# TODO: Not working, since models.py can't load config.DATABASE
class Config(object):
DATABASE = "targets.db"
PORT = 4999
LOGGER_NAME = "promsd"
LOG_FILE = "promsd.log"
LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
PROM_YAML_PATH = "yaml"
class ProdConfig(Config):
"""Production configuration."""
LOG_LEVEL = "INFO"
DEBUG = False
class DevConfig(Config):
"""Development configuration."""
DATABASE = ":memory:"
LOG_LEVEL = "DEBUG"
DEBUG = True
config = {
'development': DevConfig,
'production': ProdConfig,
'default': DevConfig
}