Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 5447f85

Browse files
owainlewisprydie
authored andcommitted
Update configuration field for private key passphrase (#81)
1 parent 64d8c1e commit 5447f85

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ auth:
8787
-----BEGIN RSA PRIVATE KEY-----
8888
<snip>
8989
-----END RSA PRIVATE KEY-----
90+
passphrase: my secret passphrase
9091
fingerprint: d4:1d:8c:d9:8f:00:b2:04:e9:80:09:98:ec:f8:42:7e
9192
vcn: ocid1.vcn.oc1.phx.aaaaaaaaqiqmei4yen2fuyqaiqfcejpguqs6tuaf2n2iaxiwf5cfji2s636a
9293
```

pkg/oci/client/config.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020
"io"
2121
"io/ioutil"
22+
"log"
2223
"os"
2324
"strings"
2425

@@ -44,7 +45,8 @@ type AuthConfig struct {
4445
CompartmentOCID string `yaml:"compartment"`
4546
UserOCID string `yaml:"user"`
4647
PrivateKey string `yaml:"key"`
47-
PrivateKeyPassphrase string `yaml:"key_passphase"`
48+
Passphrase string `yaml:"passphrase"`
49+
PrivateKeyPassphrase string `yaml:"key_passphase"` // DEPRECIATED
4850
Fingerprint string `yaml:"fingerprint"`
4951
VcnOCID string `yaml:"vcn"`
5052
}
@@ -116,6 +118,12 @@ func (c *Config) setDefaults() error {
116118
if err != nil {
117119
return fmt.Errorf("setting config region fields: %v", err)
118120
}
121+
122+
if c.Auth.Passphrase == "" && c.Auth.PrivateKeyPassphrase != "" {
123+
log.Print("config: auth.key_passphrase is DEPRECIATED and will be removed in a later release. Please set auth.passphrase instead.")
124+
c.Auth.Passphrase = c.Auth.PrivateKeyPassphrase
125+
}
126+
119127
return nil
120128
}
121129

pkg/oci/client/oci.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func New(configPath string) (Interface, error) {
9191
config.Auth.Region,
9292
config.Auth.Fingerprint,
9393
config.Auth.PrivateKey,
94-
&config.Auth.PrivateKeyPassphrase,
94+
&config.Auth.Passphrase,
9595
)
9696
computeClient, err := core.NewComputeClientWithConfigurationProvider(configProvider)
9797
if err != nil {

0 commit comments

Comments
 (0)