Skip to content

Commit

Permalink
Add version to databases path
Browse files Browse the repository at this point in the history
  • Loading branch information
krhubert committed Apr 22, 2019
1 parent 2c3be36 commit f52364a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import (
"github.com/sirupsen/logrus"
)

const envPrefix = "mesg"
const (
envPrefix = "mesg"

serviceDBVersion = "v1"
executionDBVersion = "v2"
)

var (
instance *Config
Expand Down Expand Up @@ -75,8 +80,8 @@ func New() (*Config, error) {
c.Core.Image = "mesg/core:" + strings.Split(version.Version, " ")[0]
c.Core.Name = "core"
c.Core.Path = filepath.Join(home, ".mesg")
c.Core.Database.ServiceRelativePath = filepath.Join("database", "services")
c.Core.Database.ExecutionRelativePath = filepath.Join("database", "executions")
c.Core.Database.ServiceRelativePath = filepath.Join("database", "services", serviceDBVersion)
c.Core.Database.ExecutionRelativePath = filepath.Join("database", "executions", executionDBVersion)
c.Docker.Core.Path = "/mesg"
c.Docker.Socket = "/var/run/docker.sock"
c.Service = c.getServiceConfigGroup()
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func TestDefaultValue(t *testing.T) {
require.Equal(t, "info", c.Log.Level)
require.Equal(t, false, c.Log.ForceColors)
require.Equal(t, filepath.Join(home, ".mesg"), c.Core.Path)
require.Equal(t, filepath.Join("database", "services"), c.Core.Database.ServiceRelativePath)
require.Equal(t, filepath.Join("database", "executions"), c.Core.Database.ExecutionRelativePath)
require.Equal(t, filepath.Join("database", "services", serviceDBVersion), c.Core.Database.ServiceRelativePath)
require.Equal(t, filepath.Join("database", "executions", executionDBVersion), c.Core.Database.ExecutionRelativePath)
require.Equal(t, "core", c.Core.Name)
require.Equal(t, "/mesg", c.Docker.Core.Path)
require.Equal(t, "/var/run/docker.sock", c.Docker.Socket)
Expand Down

0 comments on commit f52364a

Please sign in to comment.