Пример #1
0
        public NelsonHubSqlDataAccess(IConfiguration config)
        {
            _config = config;

            var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            if (env == "Development")
            {
                _connectionString = _config[CONNECTION_STRING_NAME];
            }
            else
            {
                string postgresURL = Environment.GetEnvironmentVariable(DATABASE_URL_NAME);

                _connectionString = PostgresConnectionHelper.ParseConnectionURL(postgresURL);
            }
        }
Пример #2
0
        public PostgresDataAccess(IConfiguration config)
        {
            _config = config;

            var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            if (env == "Development")
            {
                _connectionString = _config["PostgresConnectionString"];
            }
            else
            {
                string herokuPostgresURL = Environment.GetEnvironmentVariable(DATABASE_URL_NAME);

                _connectionString = PostgresConnectionHelper.ParseConnectionURL(herokuPostgresURL);
            }
        }