Skip to content

Commit

Permalink
Merge pull request #67 from surajssd/env_var_substitution
Browse files Browse the repository at this point in the history
Support for environment variables substitution
  • Loading branch information
surajssd authored Aug 2, 2016
2 parents 16cfec0 + 934a3e1 commit a63d641
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 81 deletions.
88 changes: 44 additions & 44 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions cli/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ import (
"fmt"
"math/rand"
"os"
"path/filepath"
"strconv"
"strings"

"github.com/Sirupsen/logrus"
"github.com/urfave/cli"

"github.com/docker/docker/api/client/bundlefile"
"github.com/docker/libcompose/config"
"github.com/docker/libcompose/docker"
"github.com/docker/libcompose/lookup"
"github.com/docker/libcompose/project"

"encoding/json"
Expand Down Expand Up @@ -789,6 +792,25 @@ func loadComposeFile(file string) KomposeObject {
}
context.ComposeFiles = []string{file}

if context.ResourceLookup == nil {
context.ResourceLookup = &lookup.FileResourceLookup{}
}

if context.EnvironmentLookup == nil {
cwd, err := os.Getwd()
if err != nil {
return KomposeObject{}
}
context.EnvironmentLookup = &lookup.ComposableEnvLookup{
Lookups: []config.EnvironmentLookup{
&lookup.EnvfileLookup{
Path: filepath.Join(cwd, ".env"),
},
&lookup.OsEnvLookup{},
},
}
}

// load compose file into composeObject
composeObject := project.NewProject(&context.Context, nil, nil)
err := composeObject.Parse()
Expand Down
40 changes: 27 additions & 13 deletions vendor/github.com/docker/libcompose/config/merge.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/libcompose/docker/project.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/libcompose/docker/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions vendor/github.com/docker/libcompose/lookup/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a63d641

Please sign in to comment.