Exemplo n.º 1
0
        public static DynamiConfiguration EnvironmentVars(this InterpreterSources provider, params string[] vars)
        {
            var conf = new Configuration();

            foreach (var @var in vars)
            {
                conf[@var] = Environment.GetEnvironmentVariable(@var);
            }

            provider.RegisterConfiguration(conf);

            return(provider.Configuration);
        }
Exemplo n.º 2
0
        public static DynamiConfiguration AppSettings(this InterpreterSources provider, string prefix = "")
        {
            var conf = new Configuration();

            foreach (var key in ConfigurationManager.AppSettings.AllKeys.Where(key => key.StartsWith(prefix)))
            {
                conf[key] = ConfigurationManager.AppSettings[key];
            }

            provider.RegisterConfiguration(conf);

            return(provider.Configuration);
        }
Exemplo n.º 3
0
 public static DynamiConfiguration ExpandoObject(this InterpreterSources provider, ExpandoObject obj)
 {
     provider.RegisterConfiguration(ExpandoObject2Configuration.Transform(obj));
     return(provider.Configuration);
 }