21 lines
417 B
Python
21 lines
417 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
|
|
CONF_FILE = '/srv/vm/config.json'
|
|
|
|
class Config:
|
|
def __init__(self):
|
|
self.load()
|
|
|
|
def load(self):
|
|
with open(CONF_FILE, 'r') as f:
|
|
self.data = json.load(f)
|
|
|
|
def save(self):
|
|
with open(CONF_FILE, 'w') as f:
|
|
json.dump(self.data, f, sort_keys=True, indent=4)
|
|
|
|
def __getitem__(self, attr):
|
|
return self.data[attr]
|