mythicbeastsddns/snap/hooks/configure

18 lines
427 B
Plaintext
Raw Normal View History

2018-07-14 01:39:04 +00:00
#! /usr/bin/python3
import os
import configparser
CONFIG_FILE=os.environ['SNAP_DATA'] + '/config'
KEYS=['updateipv4', 'updateipv6', 'domain', 'password', 'ipv4hostname', 'ipv6hostname']
config = configparser.ConfigParser()
config.read(CONFIG_FILE)
for key in KEYS:
value = os.popen('snapctl get ' + key).read()
config.set('User', key, value)
with open(CONFIG_FILE, 'w') as configfile:
config.write(configfile)