public Deployer() { try { var deploymentConfigContent = System.IO.File.ReadAllText(DEPLOYMENT_CONFIG_JSON); _deploymentConfiguration = JsonConvert.DeserializeObject <DeploymentConfiguration>(deploymentConfigContent); } catch (IOException ex) { Log("Stop Error: {0}", ConsoleColor.Red, ex.Message); Console.ResetColor(); throw new ApplicationException("Error initializing deployment system"); } try { if (System.IO.File.Exists(DEPLOYMENT_CREDENTIAL_JSON)) { var deploymentCredentialContent = System.IO.File.ReadAllText(DEPLOYMENT_CREDENTIAL_JSON); _credentialConfiguration = JsonConvert.DeserializeObject <CredentialConfiguration>(deploymentCredentialContent); } else { if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.User))) { _credentialConfiguration = new CredentialConfiguration() { Username = Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.User), Password = Environment.GetEnvironmentVariable("spdeployment:password", EnvironmentVariableTarget.User) }; } else if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.Process))) { _credentialConfiguration = new CredentialConfiguration() { Username = Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.Process), Password = Environment.GetEnvironmentVariable("spdeployment:password", EnvironmentVariableTarget.Process) }; } else if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.Machine))) { _credentialConfiguration = new CredentialConfiguration() { Username = Environment.GetEnvironmentVariable("spdeployment:username", EnvironmentVariableTarget.Machine), Password = Environment.GetEnvironmentVariable("spdeployment:password", EnvironmentVariableTarget.Machine) }; } } } catch { /* ignore errors for credentials config */ } }
public Deployer() { try { var deploymentConfigContent = System.IO.File.ReadAllText(DEPLOYMENT_CONFIG_JSON); _deploymentConfiguration = JsonConvert.DeserializeObject<DeploymentConfiguration>(deploymentConfigContent); } catch (IOException ex) { Log("Stop Error: {0}", ConsoleColor.Red, ex.Message); Console.ResetColor(); throw new ApplicationException("Error initializing deployment system"); } try { if (System.IO.File.Exists(DEPLOYMENT_CREDENTIAL_JSON)) { var deploymentCredentialContent = System.IO.File.ReadAllText(DEPLOYMENT_CREDENTIAL_JSON); _credentialConfiguration = JsonConvert.DeserializeObject<CredentialConfiguration>(deploymentCredentialContent); } } catch {/* ignore errors for credentials config */} }
public Deployer() { try { var deploymentConfigContent = System.IO.File.ReadAllText(DEPLOYMENT_CONFIG_JSON); _deploymentConfiguration = JsonConvert.DeserializeObject <DeploymentConfiguration>(deploymentConfigContent); } catch (IOException ex) { Log("Stop Error: {0}", ConsoleColor.Red, ex.Message); Console.ResetColor(); throw new ApplicationException("Error initializing deployment system"); } try { if (System.IO.File.Exists(DEPLOYMENT_CREDENTIAL_JSON)) { var deploymentCredentialContent = System.IO.File.ReadAllText(DEPLOYMENT_CREDENTIAL_JSON); _credentialConfiguration = JsonConvert.DeserializeObject <CredentialConfiguration>(deploymentCredentialContent); } } catch { /* ignore errors for credentials config */ } }