32 lines
794 B
Go
32 lines
794 B
Go
package etc
|
|
|
|
import (
|
|
"git.sr.ht/~cco/go-scopes/config"
|
|
sql "git.sr.ht/~cco/go-scopes/storage"
|
|
)
|
|
|
|
func ConfigSqlite() *sql.Cfg {
|
|
ovr := config.Overrides("env-test").Use
|
|
return &sql.Cfg{
|
|
Driver: "sqlite",
|
|
Connstr: ovr("somefile.sqlite", SQLITE_CONNSTR),
|
|
}
|
|
}
|
|
|
|
func ConfigPgsql() *sql.Cfg {
|
|
ovr := config.Overrides("env-test").Use
|
|
return &sql.Cfg{
|
|
Driver: "postgres",
|
|
Connstr: ovr("user=ccotest password=cco dbname=ccotest", PGSQL_CONNSTR),
|
|
Schema: ovr("testing", PGSQL_SCHEMA),
|
|
}
|
|
}
|
|
|
|
// collect here the names of fields that may be overridden via
|
|
// explicit Overrides() or SCOPES_* environment settings
|
|
// (via .env or explicit setting of environment variables).
|
|
const (
|
|
SQLITE_CONNSTR = "sqlite_connstr"
|
|
PGSQL_CONNSTR = "pgsql_connstr"
|
|
PGSQL_SCHEMA = "pgsql_schema"
|
|
)
|