Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 6504a9b

Browse files
authored
Merge pull request #1156 from ndeloof/env-file
Introduce --env-file
2 parents c881e22 + ed18cef commit 6504a9b

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

cli/cmd/compose/compose.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type composeOptions struct {
3333
WorkingDir string
3434
ConfigPaths []string
3535
Environment []string
36+
EnvFile string
3637
Format string
3738
Detach bool
3839
Build bool
@@ -73,6 +74,7 @@ func (o *composeOptions) toProject() (*types.Project, error) {
7374
func (o *composeOptions) toProjectOptions() (*cli.ProjectOptions, error) {
7475
return cli.NewProjectOptions(o.ConfigPaths,
7576
cli.WithOsEnv,
77+
cli.WithEnvFile(o.EnvFile),
7678
cli.WithDotEnv,
7779
cli.WithEnv(o.Environment),
7880
cli.WithWorkingDirectory(o.WorkingDir),

cli/cmd/compose/convert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func convertCommand() *cobra.Command {
4040
convertCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
4141
convertCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
4242
convertCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
43+
convertCmd.Flags().StringVar(&opts.EnvFile, "env-file", "", "Specify an alternate environment file.")
4344
convertCmd.Flags().StringVar(&opts.Format, "format", "yaml", "Format the output. Values: [yaml | json]")
4445

4546
return convertCmd

cli/cmd/compose/up.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func upCommand(contextType string) *cobra.Command {
5555
upCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
5656
upCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
5757
upCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
58+
upCmd.Flags().StringVar(&opts.EnvFile, "env-file", "", "Specify an alternate environment file.")
5859
upCmd.Flags().BoolVarP(&opts.Detach, "detach", "d", false, "Detached mode: Run containers in the background")
5960
upCmd.Flags().BoolVar(&opts.Build, "build", false, "Build images before starting containers.")
6061
upCmd.Flags().BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/awslabs/goformation/v4 v4.15.6
1818
github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129
1919
github.com/cnabio/cnab-to-oci v0.3.1-beta1
20-
github.com/compose-spec/compose-go v0.0.0-20210113150448-e0b1ffe70cc5
20+
github.com/compose-spec/compose-go v0.0.0-20210119095023-cd294eea46e9
2121
github.com/containerd/console v1.0.1
2222
github.com/containerd/containerd v1.4.3
2323
github.com/containerd/continuity v0.0.0-20200928162600-f2cc35102c2a // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ github.com/cnabio/cnab-to-oci v0.3.1-beta1/go.mod h1:8BomA5Vye+3V/Kd2NSFblCBmp1r
271271
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
272272
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
273273
github.com/codahale/hdrhistogram v0.0.0-20160425231609-f8ad88b59a58/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
274-
github.com/compose-spec/compose-go v0.0.0-20210113150448-e0b1ffe70cc5 h1:YBR7Ds5WrY+FNxN2aRRZyEB1E86PD+g1O5RjK++acx8=
275-
github.com/compose-spec/compose-go v0.0.0-20210113150448-e0b1ffe70cc5/go.mod h1:rz7rjxJGA/pWpLdBmDdqymGm2okEDYgBE7yx569xW+I=
274+
github.com/compose-spec/compose-go v0.0.0-20210119095023-cd294eea46e9 h1:fk9KYzKkVy6q1ETSXOPDHxeoj2ZBKZFP27XVfVMRMUM=
275+
github.com/compose-spec/compose-go v0.0.0-20210119095023-cd294eea46e9/go.mod h1:rz7rjxJGA/pWpLdBmDdqymGm2okEDYgBE7yx569xW+I=
276276
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
277277
github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM=
278278
github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340 h1:9atoWyI9RtXFwf7UDbme/6M8Ud0rFrx+Q3ZWgSnsxtw=

0 commit comments

Comments
 (0)