Rename Config.GetDatabaseDsn() to DatabaseDsn(), see #50
This commit is contained in:
parent
3eb61dff47
commit
b365a2ce57
6 changed files with 10 additions and 10 deletions
|
@ -27,7 +27,7 @@ func configAction(ctx *cli.Context) error {
|
|||
fmt.Printf("cache-path %s\n", conf.GetCachePath())
|
||||
fmt.Printf("assets-path %s\n", conf.GetAssetsPath())
|
||||
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
|
||||
fmt.Printf("database-dsn %s\n", conf.GetDatabaseDsn())
|
||||
fmt.Printf("database-dsn %s\n", conf.DatabaseDsn())
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ func (c *Config) CreateDirectories() error {
|
|||
// It tries to do this 12 times with a 5 second sleep interval in between.
|
||||
func (c *Config) connectToDatabase() error {
|
||||
dbDriver := c.DatabaseDriver()
|
||||
dbDsn := c.GetDatabaseDsn()
|
||||
dbDsn := c.DatabaseDsn()
|
||||
|
||||
isTiDB := false
|
||||
initSuccess := false
|
||||
|
@ -371,8 +371,8 @@ func (c *Config) DatabaseDriver() string {
|
|||
return c.databaseDriver
|
||||
}
|
||||
|
||||
// GetDatabaseDsn returns the database data source name (DSN).
|
||||
func (c *Config) GetDatabaseDsn() string {
|
||||
// DatabaseDsn returns the database data source name (DSN).
|
||||
func (c *Config) DatabaseDsn() string {
|
||||
return c.databaseDsn
|
||||
}
|
||||
|
||||
|
|
|
@ -35,5 +35,5 @@ func TestConfig_SetValuesFromFile(t *testing.T) {
|
|||
assert.Equal(t, "/srv/photoprism/photos/import", c.GetImportPath())
|
||||
assert.Equal(t, "/srv/photoprism/photos/export", c.GetExportPath())
|
||||
assert.Equal(t, "tidb", c.DatabaseDriver())
|
||||
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.GetDatabaseDsn())
|
||||
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.DatabaseDsn())
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ type Config interface {
|
|||
HttpServerMode() string
|
||||
|
||||
DatabaseDriver() string
|
||||
GetDatabaseDsn() string
|
||||
DatabaseDsn() string
|
||||
GetOriginalsPath() string
|
||||
GetImportPath() string
|
||||
GetExportPath() string
|
||||
|
|
|
@ -59,7 +59,7 @@ func TestContextConfig_SetValuesFromFile(t *testing.T) {
|
|||
assert.Equal(t, "/srv/photoprism/photos/import", c.GetImportPath())
|
||||
assert.Equal(t, "/srv/photoprism/photos/export", c.GetExportPath())
|
||||
assert.Equal(t, "tidb", c.DatabaseDriver())
|
||||
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.GetDatabaseDsn())
|
||||
assert.Equal(t, "root:@tcp(localhost:4000)/photoprism?parseTime=true", c.DatabaseDsn())
|
||||
}
|
||||
|
||||
func TestTestConfig_ConnectToDatabase(t *testing.T) {
|
||||
|
|
|
@ -128,7 +128,7 @@ func (c *Config) CreateDirectories() error {
|
|||
// It tries to do this 12 times with a 5 second sleep intervall in between.
|
||||
func (c *Config) connectToDatabase() error {
|
||||
dbDriver := c.DatabaseDriver()
|
||||
dbDsn := c.GetDatabaseDsn()
|
||||
dbDsn := c.DatabaseDsn()
|
||||
|
||||
db, err := gorm.Open(dbDriver, dbDsn)
|
||||
|
||||
|
@ -228,8 +228,8 @@ func (c *Config) DatabaseDriver() string {
|
|||
return DatabaseDriver
|
||||
}
|
||||
|
||||
// GetDatabaseDsn returns the database data source name (DSN).
|
||||
func (c *Config) GetDatabaseDsn() string {
|
||||
// DatabaseDsn returns the database data source name (DSN).
|
||||
func (c *Config) DatabaseDsn() string {
|
||||
return DatabaseDsn
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue