mythicbeastsddns/snap/hooks/configure
2018-07-14 02:39:04 +01:00

18 lines
427 B
Python
Executable File

#! /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)