using Npgsql;

public static class Db
{
    static string CS =>
        $"Host={Env("DB_HOST","localhost")};" +
        $"Port={Env("DB_PORT","5434")};" +
        $"Database={Env("DB_NAME","arseniyborisov")};" +
        $"Username={Env("DB_USER","postgres")};" +
        $"Password={Env("DB_PASSWORD","123")}";

    static string Env(string key, string def) =>
        System.Environment.GetEnvironmentVariable(key) ?? def;

    public static NpgsqlConnection Conn() => new NpgsqlConnection(CS);
}