mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +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()
|
||||
|
||||
DEFAULT_CONFIG_FILE = '/etc/plinth/plinth.config'
|
||||
DEFAULT_ROOT = '/'
|
||||
|
||||
|
||||
def read():
|
||||
"""Read configuration"""
|
||||
directory = os.path.dirname(os.path.realpath(__file__))
|
||||
directory = os.path.join(directory, '..')
|
||||
if os.path.isfile(DEFAULT_CONFIG_FILE):
|
||||
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(
|
||||
defaults={
|
||||
'root': directory,
|
||||
})
|
||||
parser.read(os.path.join(directory, 'plinth.config'))
|
||||
parser.read(config_file)
|
||||
|
||||
config_items = {('Name', 'product_name'),
|
||||
('Name', 'box_name'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user