Skip to content

Commit

Permalink
Incorporate review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ra-jeev committed Jul 7, 2023
1 parent be44bff commit f43221e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
15 changes: 4 additions & 11 deletions plugins/appwrite/api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package appwrite

import (
"context"
"os"

"encoding/json"

Expand All @@ -15,12 +14,7 @@ import (
)

func ConfigPath() string {
configDir, err := os.UserHomeDir()
if err != nil {
return "~/.appwrite/prefs.json"
}

return configDir + "/.appwrite/prefs.json"
return "~/.appwrite/prefs.json"
}

func APIKey() schema.CredentialType {
Expand Down Expand Up @@ -49,9 +43,8 @@ func APIKey() schema.CredentialType {
},
},
DefaultProvisioner: provision.TempFile(appwriteConfig, provision.AtFixedPath(ConfigPath())),
Importer: importer.TryAll(
TryAppwriteConfigFile(),
)}
Importer: TryAppwriteConfigFile(),
}
}

func appwriteConfig(in sdk.ProvisionInput) ([]byte, error) {
Expand All @@ -60,7 +53,7 @@ func appwriteConfig(in sdk.ProvisionInput) ([]byte, error) {
Endpoint: in.ItemFields[fieldname.Endpoint],
}

contents, err := json.MarshalIndent(&config, "", " ")
contents, err := json.Marshal(&config)
if err != nil {
return nil, err
}
Expand Down
5 changes: 1 addition & 4 deletions plugins/appwrite/test-fixtures/prefs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{
"key": "zsaugacpwq6k54nnbdbmh1cys98u2a32qqkacma2ioxn1e2j6eyrk9urom0vzcvm6qbbm8s6l4xbm86n37foauiqba9tlcvohuoz87j7nwvpob5wr71k58i105fn39a10vj7ob84opwf1vrfat3m8konch7xxy2z2dh1ykohdbef7xgmvtn82lebe4mzmfzoylqy4jslrok11zbjtmd6xs84ukd7b1k9ofyuanvinmlhkgua32p5x0gqbexample",
"endpoint": "http://localhost/v1"
}
{"key":"zsaugacpwq6k54nnbdbmh1cys98u2a32qqkacma2ioxn1e2j6eyrk9urom0vzcvm6qbbm8s6l4xbm86n37foauiqba9tlcvohuoz87j7nwvpob5wr71k58i105fn39a10vj7ob84opwf1vrfat3m8konch7xxy2z2dh1ykohdbef7xgmvtn82lebe4mzmfzoylqy4jslrok11zbjtmd6xs84ukd7b1k9ofyuanvinmlhkgua32p5x0gqbexample","endpoint":"http://localhost/v1"}

0 comments on commit f43221e

Please sign in to comment.