Revision d83a2834 kamaki/config.py
b/kamaki/config.py | ||
---|---|---|
39 | 39 |
from .utils import OrderedDict |
40 | 40 |
|
41 | 41 |
|
42 |
# Path to the file that stores the configuration |
|
43 |
CONFIG_PATH = os.path.expanduser('~/.kamakirc') |
|
44 |
|
|
45 |
# Name of a shell variable to bypass the CONFIG_PATH value |
|
46 |
CONFIG_ENV = 'KAMAKI_CONFIG' |
|
47 |
|
|
42 | 48 |
HEADER = """ |
43 | 49 |
# Kamaki configuration file |
44 | 50 |
""" |
... | ... | |
78 | 84 |
class Config(RawConfigParser): |
79 | 85 |
def __init__(self, path=None): |
80 | 86 |
RawConfigParser.__init__(self, dict_type=OrderedDict) |
81 |
self.path = path |
|
87 |
self.path = path or os.environ.get(CONFIG_ENV, CONFIG_PATH)
|
|
82 | 88 |
self._overrides = defaultdict(dict) |
83 |
self.read(path) |
|
89 |
self.read(self.path)
|
|
84 | 90 |
|
85 | 91 |
def sections(self): |
86 | 92 |
return DEFAULTS.keys() |
Also available in: Unified diff