func extractConfig() pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = "localhost"
	config.User = "******"
	config.Password = "******"
	config.Database = "yourdatabase"

	return config
}
Example #2
0
func extractPGXStorageConfig(c models.StorageSettings) pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = c.Host
	config.User = c.User
	config.Password = c.Password
	config.Database = c.Database
	config.Logger = databaseLogger{}
	config.LogLevel = pgx.LogLevelError

	return config
}
Example #3
0
func extractConfig() pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = os.Getenv("TODO_DB_HOST")
	if config.Host == "" {
		config.Host = "localhost"
	}

	config.User = os.Getenv("TODO_DB_USER")
	if config.User == "" {
		config.User = os.Getenv("USER")
	}

	config.Password = os.Getenv("TODO_DB_PASSWORD")

	config.Database = os.Getenv("TODO_DB_DATABASE")
	if config.Database == "" {
		config.Database = "todo"
	}

	return config
}