@@ -17,15 +17,30 @@ func (ic *ContainerEngine) SecretCreate(ctx context.Context, name string, reader
1717 if err != nil {
1818 return nil , err
1919 }
20- driverOptions := make (map [string ]string )
2120
21+ // set defaults from config for the case they are not set by an upper layer
22+ // (-> i.e. tests that talk directly to the api)
23+ cfg , err := ic .Libpod .GetConfig ()
24+ if err != nil {
25+ return nil , err
26+ }
2227 if options .Driver == "" {
23- options .Driver = "file"
28+ options .Driver = cfg .Secrets .Driver
29+ }
30+ if len (options .DriverOpts ) == 0 {
31+ options .DriverOpts = cfg .Secrets .Opts
32+ }
33+ if options .DriverOpts == nil {
34+ options .DriverOpts = make (map [string ]string )
2435 }
36+
2537 if options .Driver == "file" {
26- driverOptions ["path" ] = filepath .Join (secretsPath , "filedriver" )
38+ if _ , ok := options .DriverOpts ["path" ]; ! ok {
39+ options .DriverOpts ["path" ] = filepath .Join (secretsPath , "filedriver" )
40+ }
2741 }
28- secretID , err := manager .Store (name , data , options .Driver , driverOptions )
42+
43+ secretID , err := manager .Store (name , data , options .Driver , options .DriverOpts )
2944 if err != nil {
3045 return nil , err
3146 }
@@ -58,7 +73,8 @@ func (ic *ContainerEngine) SecretInspect(ctx context.Context, nameOrIDs []string
5873 Spec : entities.SecretSpec {
5974 Name : secret .Name ,
6075 Driver : entities.SecretDriverSpec {
61- Name : secret .Driver ,
76+ Name : secret .Driver ,
77+ Options : secret .DriverOptions ,
6278 },
6379 },
6480 }
0 commit comments