mirror of
https://github.com/weewx/weewx.git
synced 2026-05-24 01:35:18 -04:00
Use read_config() to read weewx.conf
This commit is contained in:
@@ -51,9 +51,9 @@ class Logger(object):
|
||||
# ==============================================================================
|
||||
|
||||
if sys.platform == "darwin":
|
||||
DEFAULT_LOCATIONS = ['../..', default_weewx_root, '/etc/weewx', '/Users/Shared/weewx']
|
||||
DEFAULT_LOCATIONS = [default_weewx_root, '/etc/weewx', '/Users/Shared/weewx']
|
||||
else:
|
||||
DEFAULT_LOCATIONS = ['../..', default_weewx_root, '/etc/weewx', '/home/weewx']
|
||||
DEFAULT_LOCATIONS = [default_weewx_root, '/etc/weewx', '/home/weewx']
|
||||
|
||||
|
||||
def find_file(file_path=None, args=None, locations=DEFAULT_LOCATIONS,
|
||||
|
||||
@@ -55,17 +55,10 @@ def create_station(config_path, *args, **kwargs):
|
||||
def reconfigure_station(config_path, *args, **kwargs):
|
||||
"Reconfigure an existing station"
|
||||
|
||||
if not config_path:
|
||||
config_path = weecfg.default_config_path
|
||||
config_path, config_dict = weecfg.read_config(config_path)
|
||||
|
||||
print(f"The configuration file {bcolors.BOLD}{config_path}{bcolors.ENDC} will be used.")
|
||||
|
||||
# Make sure the file exists
|
||||
if not os.path.exists(config_path):
|
||||
raise weewx.ViolatedPrecondition(f"The configuration file {config_path} does not exist")
|
||||
|
||||
config_dict = configobj.ConfigObj(config_path, encoding='utf-8', file_error=True)
|
||||
|
||||
config_config(config_dict, *args, **kwargs)
|
||||
|
||||
# Save the results with backup
|
||||
|
||||
Reference in New Issue
Block a user