@@ -25,25 +25,26 @@ func GetVolumesFromConfig(cli *client.Client, project string, config *compose.Co
25
25
return nil
26
26
}
27
27
28
- var fakeBindings = make (map [string ]string ) // Mapping on Map[ConfigName]File
28
+ var fakeConfigBindings = make (map [string ]string ) // Mapping on Map[ConfigName]File
29
29
func GetConfigsFromConfig (prjDir string , config * compose.Config ) error {
30
30
for k , v := range config .Configs {
31
31
name := k
32
32
if v .Name != "" {
33
33
name = v .Name
34
34
}
35
- fakeBindings [name ] = v .File
35
+ fakeConfigBindings [name ] = v .File
36
36
}
37
37
return nil
38
38
}
39
39
40
+ var fakeSecretBindings = make (map [string ]string ) // Mapping on Map[SecretName]File
40
41
func GetSecretsFromConfig (prjDir string , config * compose.Config ) error {
41
42
for k , v := range config .Secrets {
42
43
name := k
43
44
if v .Name != "" {
44
45
name = v .Name
45
46
}
46
- fakeBindings [name ] = v .File
47
+ fakeSecretBindings [name ] = v .File
47
48
}
48
49
return nil
49
50
}
@@ -141,23 +142,23 @@ func CreateContainerConfigMounts(s compose.ServiceConfig, prjDir string) ([]moun
141
142
for _ , f := range s .Configs {
142
143
fileRefs = append (fileRefs , compose .FileReferenceConfig (f ))
143
144
}
144
- return createFakeMounts (fileRefs , prjDir )
145
+ return createFakeMounts (fileRefs , fakeConfigBindings , prjDir )
145
146
}
146
147
147
148
func CreateContainerSecretMounts (s compose.ServiceConfig , prjDir string ) ([]mount.Mount , error ) {
148
149
var fileRefs []compose.FileReferenceConfig
149
150
for _ , f := range s .Secrets {
150
151
fileRefs = append (fileRefs , compose .FileReferenceConfig (f ))
151
152
}
152
- return createFakeMounts (fileRefs , prjDir )
153
+ return createFakeMounts (fileRefs , fakeSecretBindings , prjDir )
153
154
}
154
155
155
- func createFakeMounts (fileRefs []compose.FileReferenceConfig , prjDir string ) ([]mount.Mount , error ) {
156
+ func createFakeMounts (fileRefs []compose.FileReferenceConfig , fakeBindings map [ string ] string , prjDir string ) ([]mount.Mount , error ) {
156
157
var mounts []mount.Mount
157
158
for _ , v := range fileRefs {
158
159
source , ok := fakeBindings [v .Source ]
159
160
if ! ok {
160
- source = v .Source
161
+ return nil , fmt . Errorf ( "couldn't find reference %q" , v .Source )
161
162
}
162
163
target := v .Target
163
164
if target == "" {
0 commit comments