Rename Config.GetDatabaseDriver() to DatabaseDriver, see #50

This commit is contained in:
Michael Mayer 2018-12-21 03:18:43 +01:00
parent ef2719e21e
commit 3eb61dff47
6 changed files with 10 additions and 10 deletions

View file

@ -26,7 +26,7 @@ func configAction(ctx *cli.Context) error {
fmt.Printf("export-path %s\n", conf.GetExportPath())
fmt.Printf("cache-path %s\n", conf.GetCachePath())
fmt.Printf("assets-path %s\n", conf.GetAssetsPath())
fmt.Printf("database-driver %s\n", conf.GetDatabaseDriver())
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
fmt.Printf("database-dsn %s\n", conf.GetDatabaseDsn())
return nil

View file

@ -248,7 +248,7 @@ func (c *Config) CreateDirectories() error {
// When used with the tidb driver, it may create a new database server instance.
// It tries to do this 12 times with a 5 second sleep interval in between.
func (c *Config) connectToDatabase() error {
dbDriver := c.GetDatabaseDriver()
dbDriver := c.DatabaseDriver()
dbDsn := c.GetDatabaseDsn()
isTiDB := false
@ -366,8 +366,8 @@ func (c *Config) GetDarktableCli() string {
return c.darktableCli
}
// GetDatabaseDriver returns the database driver name.
func (c *Config) GetDatabaseDriver() string {
// DatabaseDriver returns the database driver name.
func (c *Config) DatabaseDriver() string {
return c.databaseDriver
}

View file

@ -34,6 +34,6 @@ func TestConfig_SetValuesFromFile(t *testing.T) {
assert.Equal(t, "/srv/photoprism/photos/originals", c.GetOriginalsPath())
assert.Equal(t, "/srv/photoprism/photos/import", c.GetImportPath())
assert.Equal(t, "/srv/photoprism/photos/export", c.GetExportPath())
assert.Equal(t, "tidb", c.GetDatabaseDriver())
assert.Equal(t, "tidb", c.DatabaseDriver())
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.GetDatabaseDsn())
}

View file

@ -29,7 +29,7 @@ type Config interface {
HttpServerPort() int
HttpServerMode() string
GetDatabaseDriver() string
DatabaseDriver() string
GetDatabaseDsn() string
GetOriginalsPath() string
GetImportPath() string

View file

@ -58,7 +58,7 @@ func TestContextConfig_SetValuesFromFile(t *testing.T) {
assert.Equal(t, "/srv/photoprism/photos/originals", c.GetOriginalsPath())
assert.Equal(t, "/srv/photoprism/photos/import", c.GetImportPath())
assert.Equal(t, "/srv/photoprism/photos/export", c.GetExportPath())
assert.Equal(t, "tidb", c.GetDatabaseDriver())
assert.Equal(t, "tidb", c.DatabaseDriver())
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.GetDatabaseDsn())
}

View file

@ -127,7 +127,7 @@ func (c *Config) CreateDirectories() error {
// connectToDatabase estabilishes a connection to a database given a driver.
// It tries to do this 12 times with a 5 second sleep intervall in between.
func (c *Config) connectToDatabase() error {
dbDriver := c.GetDatabaseDriver()
dbDriver := c.DatabaseDriver()
dbDsn := c.GetDatabaseDsn()
db, err := gorm.Open(dbDriver, dbDsn)
@ -223,8 +223,8 @@ func (c *Config) GetDarktableCli() string {
return DarktableCli
}
// GetDatabaseDriver returns the database driver name.
func (c *Config) GetDatabaseDriver() string {
// DatabaseDriver returns the database driver name.
func (c *Config) DatabaseDriver() string {
return DatabaseDriver
}