go-scopes/tests/etc/etc_sqlite.go

29 lines
653 B
Go

package etc
import (
"git.sr.ht/~cco/go-scopes/config"
"git.sr.ht/~cco/go-scopes/storage/sql"
)
func ConfigSqlite() *sql.Cfg {
ovr := OverridesSqlite().Use
return &sql.Cfg{
Driver: "sqlite",
Connstr: ovr("somefile.sqlite", SQLITE_CONNSTR),
}
}
// collect here the names of fields that may be overridden via
// explicit Override() or SCOPES_* environment settings.
const (
SQLITE_CONNSTR = "sqlite_connstr"
)
// in a production scenario this should be put in a separate
// file `settings.go` that should not be stored in code repository.
func OverridesSqlite() config.Settings {
return config.Settings{
SQLITE_CONNSTR: ":memory",
}
}