public ConfigurationLocationsParser(IFileSystem fileSystemInstance, IEnvironmentVariableProvider environmentVariableProvider)
        {
            AppName = CurrentApplicationInfo.Name;
            environmentVariableProvider.SetEnvironmentVariableForProcess("AppName", CurrentApplicationInfo.Name);

            ConfigRoot = environmentVariableProvider.GetEnvironmentVariable(HS_CONFIG_ROOT);

            if (string.IsNullOrEmpty(ConfigRoot))
            {
                ConfigRoot = environmentVariableProvider.PlatformSpecificPathPrefix + HS_CONFIG_ROOT_DEFAULT;
            }

            LoadPathsFilePath = environmentVariableProvider.GetEnvironmentVariable(HS_CONFIG_PATHS_FILE);

            if (string.IsNullOrEmpty(LoadPathsFilePath))
            {
                LoadPathsFilePath = Path.Combine(ConfigRoot, LOADPATHS_JSON);
            }

            //Normalize slashes
            LoadPathsFilePath = LoadPathsFilePath.Replace("\\", "/");

            Trace.WriteLine("Started parsing configurations from location " + LoadPathsFilePath + "\n");

            var configPathDeclarations = ParseAndValidateConfigLines(LoadPathsFilePath, fileSystemInstance);

            ConfigFileDeclarations = ExpandConfigPathDeclarations(environmentVariableProvider, configPathDeclarations, environmentVariableProvider.PlatformSpecificPathPrefix).ToArray();
        }
Esempio n. 2
0
 public void SetEnvironmentVariableForProcess(string name, string value)
 {
     _environmentVariableProvider.SetEnvironmentVariableForProcess(name, value);
 }