Skip to content
Snippets Groups Projects
config.py 447 B
Newer Older
torrespel's avatar
torrespel committed
import os

torrespel's avatar
torrespel committed
#Config class to get config
class Config:
torrespel's avatar
torrespel committed
    def __init__(self):
        self.cached = 0
torrespel's avatar
torrespel committed
        self.my_config = {}
torrespel's avatar
torrespel committed

torrespel's avatar
torrespel committed
        stamp = os.stat(self.file).st_mtime
        if stamp != self.cached:
            self.cached = stamp
            f = open(self.file)
            self.my_config = yaml.safe_load(f)
            f.close()
torrespel's avatar
torrespel committed

torrespel's avatar
torrespel committed
    def get_config(self):
        return self.my_config
torrespel's avatar
torrespel committed