Browse code

allow usage of environment variables as config values

Ori Bar authored on 2011/08/15 02:23:29
Showing 1 changed files
... ...
@@ -6,6 +6,7 @@
6 6
 import logging
7 7
 from logging import debug, info, warning, error
8 8
 import re
9
+import os
9 10
 import Progress
10 11
 from SortedDict import SortedDict
11 12
 
... ...
@@ -116,6 +117,9 @@ class Config(object):
116 116
     def update_option(self, option, value):
117 117
         if value is None:
118 118
             return
119
+        #### Handle environment reference
120
+        if str(value).startswith("$"):
121
+            return self.update_option(option, os.getenv(str(value)[1:]))
119 122
         #### Special treatment of some options
120 123
         ## verbosity must be known to "logging" module
121 124
         if option == "verbosity":