mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
Merge simple config changes.
This commit is contained in:
commit
1eb5dde1f7
50
cfg.py
50
cfg.py
@ -2,39 +2,35 @@ from menu import Menu
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
|
|
||||||
|
def get_item(parser, section, name):
|
||||||
|
try:
|
||||||
|
return parser.get(section, name)
|
||||||
|
except (SafeConfigParser.NoSectionError, SafeConfigParser.NoOptionError):
|
||||||
|
print ("The config file {} does not contain the {}.{} option.".format(
|
||||||
|
parser[0], section, name))
|
||||||
|
raise
|
||||||
|
|
||||||
parser = SafeConfigParser(
|
parser = SafeConfigParser(
|
||||||
defaults={
|
defaults={
|
||||||
'root':os.path.dirname(os.path.realpath(__file__)),
|
'root':os.path.dirname(os.path.realpath(__file__)),
|
||||||
'product_name':"",
|
|
||||||
'box_name':"",
|
|
||||||
'file_root':"",
|
|
||||||
'python_root':"",
|
|
||||||
'data_dir':"",
|
|
||||||
'store_file':"",
|
|
||||||
'user_db':"",
|
|
||||||
'status_log_file':"",
|
|
||||||
'access_log_file':"",
|
|
||||||
'users_dir':"",
|
|
||||||
'host':"127.0.0.1",
|
|
||||||
'pidfile':"",
|
|
||||||
'port':"",
|
|
||||||
})
|
})
|
||||||
parser.read(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'plinth.config'))
|
parser.read(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'plinth.config'))
|
||||||
|
|
||||||
product_name = parser.get('Name', 'product_name')
|
product_name = get_item(parser, 'Name', 'product_name')
|
||||||
box_name = parser.get('Name', 'box_name')
|
box_name = get_item(parser, 'Name', 'box_name')
|
||||||
root = parser.get('Path', 'root')
|
root = get_item(parser, 'Path', 'root')
|
||||||
file_root = parser.get('Path', 'file_root')
|
file_root = get_item(parser, 'Path', 'file_root')
|
||||||
python_root = parser.get('Path', 'python_root')
|
python_root = get_item(parser, 'Path', 'python_root')
|
||||||
data_dir = parser.get('Path', 'data_dir')
|
data_dir = get_item(parser, 'Path', 'data_dir')
|
||||||
store_file = parser.get('Path', 'store_file')
|
store_file = get_item(parser, 'Path', 'store_file')
|
||||||
user_db = parser.get('Path', 'user_db')
|
user_db = get_item(parser, 'Path', 'user_db')
|
||||||
status_log_file = parser.get('Path', 'status_log_file')
|
status_log_file = get_item(parser, 'Path', 'status_log_file')
|
||||||
access_log_file = parser.get('Path', 'access_log_file')
|
access_log_file = get_item(parser, 'Path', 'access_log_file')
|
||||||
users_dir = parser.get('Path', 'users_dir')
|
users_dir = get_item(parser, 'Path', 'users_dir')
|
||||||
pidfile = parser.get('Path', 'pidfile')
|
pidfile = get_item(parser, 'Path', 'pidfile')
|
||||||
host = parser.get('Network', 'host')
|
host = get_item(parser, 'Network', 'host')
|
||||||
port = int(parser.get('Network', 'port'))
|
port = int(get_item(parser, 'Network', 'port'))
|
||||||
|
|
||||||
html_root = None
|
html_root = None
|
||||||
main_menu = Menu()
|
main_menu = Menu()
|
||||||
|
|||||||
@ -3,17 +3,22 @@ product_name = Plinth
|
|||||||
box_name = FreedomBox
|
box_name = FreedomBox
|
||||||
|
|
||||||
[Path]
|
[Path]
|
||||||
|
# directory locations
|
||||||
file_root = %(root)s
|
file_root = %(root)s
|
||||||
python_root = %(root)s
|
|
||||||
data_dir = %(file_root)s/data
|
data_dir = %(file_root)s/data
|
||||||
store_file = %(data_dir)s/store.sqlite3
|
log_dir = %(data_dir)s
|
||||||
user_db = %(data_dir)s/users
|
pid_dir = %(data_dir)s
|
||||||
status_log_file = %(data_dir)s/status.log
|
python_root = %(file_root)s
|
||||||
access_log_file = %(data_dir)s/access.log
|
|
||||||
users_dir = %(data_dir)s/users
|
users_dir = %(data_dir)s/users
|
||||||
pidfile = %(data_dir)s/pidfile.pid
|
|
||||||
server_dir = plinth/
|
server_dir = plinth/
|
||||||
|
|
||||||
|
# file locations
|
||||||
|
store_file = %(data_dir)s/store.sqlite3
|
||||||
|
user_db = %(users_dir)s
|
||||||
|
status_log_file = %(log_dir)s/status.log
|
||||||
|
access_log_file = %(log_dir)s/access.log
|
||||||
|
pidfile = %(pid_dir)s/pidfile.pid
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
port = 8000
|
port = 8000
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user