Follow migration to toml
Uses toml config with fallback to yaml if not toml exists. Signed-off-by: xBelladonna <isabelladonnamoore@users.noreply.github.com>
This commit is contained in:
parent
e8d3628336
commit
bd6067128d
10
clock.py
10
clock.py
@ -5,6 +5,8 @@ import pwnagotchi.plugins as plugins
|
||||
import pwnagotchi
|
||||
import logging
|
||||
import datetime
|
||||
import os
|
||||
import toml
|
||||
import yaml
|
||||
|
||||
|
||||
@ -19,8 +21,12 @@ class PwnClock(plugins.Plugin):
|
||||
|
||||
def on_ui_setup(self, ui):
|
||||
memenable = False
|
||||
with open('/etc/pwnagotchi/config.yml') as f:
|
||||
data = yaml.load(f, Loader=yaml.FullLoader)
|
||||
config_is_toml = True if os.path.exists(
|
||||
'/etc/pwnagotchi/config.toml') else False
|
||||
config_path = '/etc/pwnagotchi/config.toml' if config_is_toml else '/etc/pwnagotchi/config.yml'
|
||||
with open(config_path) as f:
|
||||
data = toml.load(f) if config_is_toml else yaml.load(
|
||||
f, Loader=yaml.FullLoader)
|
||||
|
||||
if 'memtemp' in data["main"]["plugins"]:
|
||||
if 'enabled' in data["main"]["plugins"]["memtemp"]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user