@@ -98,6 +98,44 @@ func main() {
9898 os .Setenv ("REGISTRY_STORAGE_S3_REGION" , "us-east-1" )
9999 os .Setenv ("REGISTRY_STORAGE_S3_BUCKET" , "registry" )
100100
101+ } else if storageType == "swift" {
102+ log .Println ("INFO: using swift as the backend" )
103+ if authurl , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/authurl" ); err != nil {
104+ log .Fatal (err )
105+ } else {
106+ os .Setenv ("REGISTRY_STORAGE_SWIFT_AUTHURL" , string (authurl ))
107+ }
108+
109+ if username , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/username" ); err != nil {
110+ log .Fatal (err )
111+ } else {
112+ os .Setenv ("REGISTRY_STORAGE_SWIFT_USERNAME" , string (username ))
113+ }
114+
115+ if password , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/password" ); err != nil {
116+ log .Fatal (err )
117+ } else {
118+ os .Setenv ("REGISTRY_STORAGE_SWIFT_PASSWORD" , string (password ))
119+ }
120+
121+ if container , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/registry-container" ); err != nil {
122+ log .Fatal (err )
123+ } else {
124+ os .Setenv ("REGISTRY_STORAGE_SWIFT_CONTAINER" , string (container ))
125+ }
126+
127+ if authVersion , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/authversion" ); err != nil {
128+ log .Fatal (err )
129+ } else {
130+ os .Setenv ("REGISTRY_STORAGE_SWIFT_AUTHVERSION" , string (authVersion ))
131+ }
132+
133+ if tenant , err := ioutil .ReadFile ("/var/run/secrets/deis/registry/creds/tenant" ); err != nil {
134+ log .Fatal (err )
135+ } else {
136+ os .Setenv ("REGISTRY_STORAGE_SWIFT_TENANT" , string (tenant ))
137+ }
138+
101139 }
102140
103141 cmd := exec .Command (registryBinary , command , registryConfig )
0 commit comments