lib/global_session/configuration.rb in global_session-3.2.2 vs lib/global_session/configuration.rb in global_session-3.2.3
- old
+ new
@@ -18,10 +18,11 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
require 'yaml'
+require 'erb'
module GlobalSession
# Central point of access for GlobalSession configuration information. This is
# mostly a very thin wrapper around the serialized hash written to the YAML config
# file.
@@ -95,10 +96,11 @@
# TypeError:: if config file does not contain a YAML-serialized Hash
def initialize(config, environment)
if config.is_a?(Hash)
@config = config
elsif File.file?(config)
- data = YAML.load(File.read(config))
+ yaml = ERB.new(File.read(config)).result
+ data = YAML.load(yaml)
unless data.is_a?(Hash)
raise TypeError, "Configuration file #{File.basename(config)} must contain a hash as its top-level element"
end
@config = data
else