-
-
Notifications
You must be signed in to change notification settings - Fork 483
/
config.py
146 lines (124 loc) · 4.38 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# config.py - Global Mycodo configuration settings
#
# Copyright (C) 2015 Kyle T. Gabriel
#
# This file is part of Mycodo
#
# Mycodo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Mycodo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mycodo. If not, see <http://www.gnu.org/licenses/>.
#
# Contact at kylegabriel.com
import os
MYCODO_VERSION = '5.0.0'
ALEMBIC_VERSION = ''
LANGUAGES = {
'en': 'English',
'es': 'Español',
'fr': 'Français'
}
MEASUREMENT_UNITS = {
'cpu_load_1m': '',
'cpu_load_5m': '',
'cpu_load_15m': '',
'duration_sec': 'sec',
'temperature': 'C',
'temperature_object': 'C',
'temperature_die': 'C',
'humidity': '%',
'dewpoint': 'C',
'co2': 'ppmv',
'lux': 'lx',
'pressure': 'Pa',
'altitude': 'm'
}
CAM_TYPES = (
'Still',
'Time-lapse',
'Stream'
)
USER_ROLES = [
dict(id=1, name='Admin',
edit_camera=True, edit_controllers=True, edit_users=True,
view_settings=True, view_camera=True, view_stats=True,
view_logs=True),
dict(id=2, name='Editor',
edit_camera=True, edit_controllers=True, edit_users=False,
view_settings=True, view_camera=True, view_stats=True,
view_logs=True),
dict(id=3, name='Monitor',
edit_camera=False, edit_controllers=False, edit_users=False,
view_settings=True, view_camera=True, view_stats=True,
view_logs=True),
dict(id=4, name='Guest',
edit_camera=False, edit_controllers=False, edit_users=False,
view_settings=False, view_camera=False, view_stats=False,
view_logs=False)
]
INSTALL_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) + '/..'
LOCK_PATH = '/var/lock'
DAEMON_PID_FILE = os.path.join(LOCK_PATH, 'mycodo.pid')
# Logging
LOG_PATH = '/var/log/mycodo' # Where generated logs are stored
LOGIN_LOG_FILE = os.path.join(LOG_PATH, 'login.log')
DAEMON_LOG_FILE = os.path.join(LOG_PATH, 'mycodo.log')
UPGRADE_LOG_FILE = os.path.join(LOG_PATH, 'mycodoupgrade.log')
RESTORE_LOG_FILE = os.path.join(LOG_PATH, 'mycodorestore.log')
HTTP_LOG_FILE = '/var/log/apache2/error.log'
# SQLite3 databases that hold users and settings
DATABASE_PATH = os.path.join(INSTALL_DIRECTORY, 'databases')
SQL_DATABASE_MYCODO_5 = os.path.join(DATABASE_PATH, 'mycodo_5.db')
# SQL_DATABASE_MYCODO = os.path.join(DATABASE_PATH, 'mycodo.db')
# SQL_DATABASE_USER = os.path.join(DATABASE_PATH, 'users.db')
# SQL_DATABASE_NOTE = os.path.join(DATABASE_PATH, 'notes.db')
MYCODO_DB_PATH = 'sqlite:///' + SQL_DATABASE_MYCODO_5
# USER_DB_PATH = 'sqlite:///' + SQL_DATABASE_USER
# Influxdb sensor/device measurement database
INFLUXDB_HOST = 'localhost'
INFLUXDB_PORT = 8086
INFLUXDB_USER = 'mycodo'
INFLUXDB_PASSWORD = 'mmdu77sj3nIoiajjs'
INFLUXDB_DATABASE = 'mycodo_db'
# Anonymous usage statistics
STATS_CSV = os.path.join(DATABASE_PATH, 'statistics.csv')
ID_FILE = os.path.join(DATABASE_PATH, 'statistics.id')
# Camera
LOCK_FILE_STREAM = os.path.join(DATABASE_PATH, 'mycodo-camera-stream.pid')
LOCK_FILE_TIMELAPSE = os.path.join(DATABASE_PATH, 'timelapse.pid')
FILE_TIMELAPSE_PARAM = os.path.join(DATABASE_PATH, 'timelapse.csv')
# Anonymous statistics
STATS_INTERVAL = 86400 # 1 day
STATS_HOST = 'fungi.kylegabriel.com'
STATS_PORT = 8086
STATS_USER = 'mycodo_stats'
STATS_PASSWORD = 'Io8Nasr5JJDdhPOj32222'
STATS_DATABASE = 'mycodo_stats'
# Login
LOGIN_ATTEMPTS = 5
LOGIN_BAN_SECONDS = 600 # 10 minutes
# Relay
MAX_AMPS = 15
class ProdConfig(object):
""" Production Configuration """
SQL_DATABASE_MYCODO_5 = os.path.join(DATABASE_PATH, 'mycodo_5.db')
MYCODO_DB_PATH = 'sqlite:///' + SQL_DATABASE_MYCODO_5
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + SQL_DATABASE_MYCODO_5
SQLALCHEMY_TRACK_MODIFICATIONS = False
class TestConfig(object):
""" Testing Configuration """
SQL_DATABASE_MYCODO = '' # defined later when tests run
MYCODO_DB_PATH = '' # defined later when tests run
TESTING = True
DEBUG = True