Skip to content

Commit

Permalink
do not use config attribute for the list of services
Browse files Browse the repository at this point in the history
  • Loading branch information
antho1404 committed Jan 23, 2019
1 parent a3b1e1a commit c40c75c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type Config struct {
Service struct {
Foo ServiceConfig
}
Services []ServiceConfig

Docker struct {
Socket string
Expand Down Expand Up @@ -86,9 +85,6 @@ func New() (*Config, error) {
c.Docker.Core.Path = "/mesg"
c.Docker.Socket = "/var/run/docker.sock"
c.Service.Foo = ServiceConfig{"https://github.com/mesg-foundation/service-ethereum-erc20", map[string]string{}}
c.Services = []ServiceConfig{
c.Service.Foo,
}
return &c, nil
}

Expand Down Expand Up @@ -138,6 +134,13 @@ func (c *Config) Validate() error {
return nil
}

// Services returns all services that the configuration package is aware of
func (c *Config) Services() []ServiceConfig {
return []ServiceConfig{
c.Service.Foo,
}
}

// DaemonEnv returns the needed environmental variable for the Daemon.
func (c *Config) DaemonEnv() map[string]string {
return map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func initGRPCServer(c *config.Config) (*grpc.Server, error) {
}

func deployCoreServices(c *config.Config, api *api.API) error {
for _, service := range c.Services {
for _, service := range c.Services() {
logrus.Infof("Deploy service from %s", service.URL)
s, valid, err := api.DeployServiceFromURL(service.URL, service.Env)
if valid != nil {
Expand Down

0 comments on commit c40c75c

Please sign in to comment.