Skip to content

Commit c363432

Browse files
committed
civo changes
1 parent 81b2ad3 commit c363432

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

plugins/civo/api_key.go

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package civo
33
import (
44
"context"
55
"encoding/json"
6-
"io/ioutil"
76
"os"
87

98
"github.com/1Password/shell-plugins/sdk"
@@ -50,7 +49,6 @@ func APIKey() schema.CredentialType {
5049
provision.AddArgs(
5150
"--config", "{{.Path}}",
5251
),
53-
provision.AtFixedPath("~/.civo.json"),
5452
),
5553
Importer: importer.TryAll(
5654
importer.TryEnvVarPair(defaultEnvVarMapping),
@@ -63,31 +61,31 @@ func configFile(in sdk.ProvisionInput) ([]byte, error) {
6361
defaultRegion := in.ItemFields[fieldname.DefaultRegion]
6462

6563
// Check if the file already exists
66-
filePath := "~/.civo.json"
67-
exists, err := fileExists(filePath)
68-
if err != nil {
69-
return nil, err
70-
}
71-
72-
if exists {
73-
// Read the existing file
74-
contents, err := ioutil.ReadFile(filePath)
75-
if err != nil {
76-
return nil, err
77-
}
78-
79-
var config Config
80-
if err := json.Unmarshal(contents, &config); err != nil {
81-
return nil, err
82-
}
83-
84-
// Update the config with the new values
85-
config.Properties[apiKeyID] = json.RawMessage(`"` + apiKey + `"`)
86-
config.Meta.CurrentAPIKey = apiKeyID
87-
config.Meta.DefaultRegion = defaultRegion
88-
89-
return json.MarshalIndent(config, "", " ")
90-
}
64+
// filePath := "~/.civo.json"
65+
// exists, err := fileExists(filePath)
66+
// if err != nil {
67+
// return nil, err
68+
// }
69+
70+
// if exists {
71+
// // Read the existing file
72+
// contents, err := ioutil.ReadFile(filePath)
73+
// if err != nil {
74+
// return nil, err
75+
// }
76+
77+
// var config Config
78+
// if err := json.Unmarshal(contents, &config); err != nil {
79+
// return nil, err
80+
// }
81+
82+
// // Update the config with the new values
83+
// config.Properties[apiKeyID] = json.RawMessage(`"` + apiKey + `"`)
84+
// config.Meta.CurrentAPIKey = apiKeyID
85+
// config.Meta.DefaultRegion = defaultRegion
86+
87+
// return json.MarshalIndent(config, "", " ")
88+
// }
9189

9290
// Create a new config
9391
config := Config{

plugins/civo/civo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ func CivoCLI() schema.Executable {
1515
NeedsAuth: needsauth.IfAll(
1616
needsauth.NotForHelpOrVersion(),
1717
needsauth.NotWithoutArgs(),
18+
needsauth.NotWhenContainsArgs("update"),
1819
),
1920
Uses: []schema.CredentialUsage{
2021
{

0 commit comments

Comments
 (0)