Esempio n. 1
0
        public EnvironmentVariableProvider(IEnvironment environment, EnvironmentVariablesFileReader fileReader)
        {
            _environment = environment;

            fileReader.ReadFromFile();
            DataCenter            = environment.GetEnvironmentVariable("DC");
            DeploymentEnvironment = environment.GetEnvironmentVariable("ENV");
            ConsulAddress         = environment.GetEnvironmentVariable("CONSUL");
        }
        public EnvironmentVariableProvider(IEnvironment environment, EnvironmentVariablesFileReader fileReader)
        {
            _environment = environment;

            fileReader.ReadFromFile();
            DataCenter            = environment.GetEnvironmentVariable("DC");
            DeploymentEnvironment = environment.GetEnvironmentVariable("ENV");
            ConsulAddress         = environment.GetEnvironmentVariable("CONSUL");

            if (string.IsNullOrEmpty(DataCenter) || string.IsNullOrEmpty(DeploymentEnvironment))
            {
                throw new EnvironmentException("One or more of the following environment variables, which are required, have not been set: %DC%, %ENV%");
            }
        }