mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Ability to read configuration from system or working directory
This commit is contained in:
parent
cf61ba3c6e
commit
e627c1795b
@ -24,16 +24,25 @@ server_dir = '/'
|
|||||||
|
|
||||||
main_menu = Menu()
|
main_menu = Menu()
|
||||||
|
|
||||||
|
DEFAULT_CONFIG_FILE = '/etc/plinth/plinth.config'
|
||||||
|
DEFAULT_ROOT = '/'
|
||||||
|
|
||||||
|
|
||||||
def read():
|
def read():
|
||||||
"""Read configuration"""
|
"""Read configuration"""
|
||||||
directory = os.path.dirname(os.path.realpath(__file__))
|
if os.path.isfile(DEFAULT_CONFIG_FILE):
|
||||||
directory = os.path.join(directory, '..')
|
config_file = DEFAULT_CONFIG_FILE
|
||||||
|
directory = DEFAULT_ROOT
|
||||||
|
else:
|
||||||
|
directory = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
directory = os.path.join(directory, '..')
|
||||||
|
config_file = os.path.join(directory, 'plinth.config')
|
||||||
|
|
||||||
parser = SafeConfigParser(
|
parser = SafeConfigParser(
|
||||||
defaults={
|
defaults={
|
||||||
'root': directory,
|
'root': directory,
|
||||||
})
|
})
|
||||||
parser.read(os.path.join(directory, 'plinth.config'))
|
parser.read(config_file)
|
||||||
|
|
||||||
config_items = {('Name', 'product_name'),
|
config_items = {('Name', 'product_name'),
|
||||||
('Name', 'box_name'),
|
('Name', 'box_name'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user