Ejemplo n.º 1
0
        private static IAppEnvVars GetAppEnvVars()
        {
            var envPath = EnvVariablesRetriever.GetRealBasePath(); //For VM Must be configured

            Program.RealPath = (String.IsNullOrEmpty(envPath)) ? Directory.GetCurrentDirectory() : envPath;
            var path = Path.Combine(RealPath, "Configs", "Enviroment", "appenviroment.json");

            if (File.Exists(path))
            {
                var doc = File.ReadAllText(path);

                try
                {
                    var objectVars = JsonConvert.DeserializeObject <MyAuthAppEnvVars>(doc);
                    return(objectVars);
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Error: {e.Message}, {e.StackTrace}");
                    goto FailureMain;
                }
            }
            FailureMain : return(null);
        }
Ejemplo n.º 2
0
 //Created For Migration creation and update database connection string selection its a result of env value ASPENVMAINACT
 public static string GetAppActiveConnectionStringOrDevelopment(this IConfiguration config) => (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPENVMAINACT"))) ?
 "Host=localhost;Database=MyAuth;Username=postgres;Password=Margoleta16!" :
 config.GetConnectionString(EnvVariablesRetriever.GetAppActiveConnectionString());