mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-05 10:08:35 +00:00
drop seeder and PSQL config
This commit is contained in:
parent
c2613a03ca
commit
194a90ccfb
7 changed files with 4 additions and 143 deletions
|
@ -22,7 +22,6 @@ type Config struct {
|
|||
Database Database `yaml:"database"`
|
||||
Log LoggerConf `yaml:"logger"`
|
||||
Mailer MailerConf `yaml:"mailer"`
|
||||
Seed Seed `yaml:"seed"`
|
||||
Swagger SwaggerConf `yaml:"swagger"`
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package config
|
||||
|
||||
const (
|
||||
DriverSqlite3 = "sqlite3"
|
||||
DriverPostgres = "postgres"
|
||||
DriverSqlite3 = "sqlite3"
|
||||
)
|
||||
|
||||
type Database struct {
|
||||
Driver string `yaml:"driver" conf:"default:sqlite3"`
|
||||
SqliteUrl string `yaml:"sqlite-url" conf:"default:file:ent?mode=memory&cache=shared&_fk=1"`
|
||||
PostgresUrl string `yaml:"postgres-url" conf:""`
|
||||
Driver string `yaml:"driver" conf:"default:sqlite3"`
|
||||
SqliteUrl string `yaml:"sqlite-url" conf:"default:file:ent?mode=memory&cache=shared&_fk=1"`
|
||||
}
|
||||
|
||||
func (d *Database) GetDriver() string {
|
||||
|
@ -19,8 +17,6 @@ func (d *Database) GetUrl() string {
|
|||
switch d.Driver {
|
||||
case DriverSqlite3:
|
||||
return d.SqliteUrl
|
||||
case DriverPostgres:
|
||||
return d.PostgresUrl
|
||||
default:
|
||||
panic("unknown database driver")
|
||||
}
|
||||
|
|
|
@ -16,16 +16,6 @@ func Test_DatabaseConfig_Sqlite(t *testing.T) {
|
|||
assert.Equal(t, "file:ent?mode=memory&cache=shared&_fk=1", dbConf.GetUrl())
|
||||
}
|
||||
|
||||
func Test_DatabaseConfig_Postgres(t *testing.T) {
|
||||
dbConf := &Database{
|
||||
Driver: DriverPostgres,
|
||||
PostgresUrl: "postgres://user:pass@host:port/dbname?sslmode=disable",
|
||||
}
|
||||
|
||||
assert.Equal(t, "postgres", dbConf.GetDriver())
|
||||
assert.Equal(t, "postgres://user:pass@host:port/dbname?sslmode=disable", dbConf.GetUrl())
|
||||
}
|
||||
|
||||
func Test_DatabaseConfig_Unknown(t *testing.T) {
|
||||
dbConf := &Database{
|
||||
Driver: "null",
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
package config
|
||||
|
||||
type SeedUser struct {
|
||||
Name string `yaml:"name"`
|
||||
Email string `yaml:"email"`
|
||||
Password string `yaml:"password"`
|
||||
IsSuperuser bool `yaml:"isSuperuser"`
|
||||
}
|
||||
|
||||
type Seed struct {
|
||||
Enabled bool `yaml:"enabled" conf:"default:false"`
|
||||
Users []SeedUser `yaml:"users"`
|
||||
Group string `yaml:"group"`
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue