Skip to content

Commit

Permalink
feat(config): add schema field to the config object
Browse files Browse the repository at this point in the history
  • Loading branch information
danvergara committed Oct 14, 2022
1 parent d2e2b8e commit d2e26c6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dblab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ database:
db: "users"
password: "password"
user: "postgres"
schema: "public"
driver: "postgres"
limit: 50
1 change: 1 addition & 0 deletions pkg/config/.dblab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ database:
db: "users"
password: "password"
user: "postgres"
schema: "public"
driver: "postgres"
limit: 50
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Config struct {
User string
Password string
Driver string `validate:"required"`
Schema string
SSL string `default:"disable"`
}
User string
Expand Down Expand Up @@ -76,6 +77,7 @@ func Init() (command.Options, error) {
Pass: cfg.Database.Password,
DBName: cfg.Database.DB,
SSL: cfg.Database.SSL,
Schema: cfg.Database.Schema,
Limit: cfg.Limit,
}

Expand Down
1 change: 1 addition & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ func TestInit(t *testing.T) {
assert.Equal(t, "postgres", opts.User)
assert.Equal(t, "password", opts.Pass)
assert.Equal(t, "postgres", opts.Driver)
assert.Equal(t, "public", opts.Schema)
assert.Equal(t, 50, opts.Limit)
}

0 comments on commit d2e26c6

Please sign in to comment.