Skip to content

Commit 7b61738

Browse files
author
Arun
committed
Switch back to hardcoding the version because it's set up automatically by the CLI program and is not a configurable value by the user
1 parent e9ee36b commit 7b61738

3 files changed

Lines changed: 2 additions & 19 deletions

File tree

plugins/ngrok/credentials.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@ func Credentials() schema.CredentialType {
4545
},
4646
},
4747
},
48-
{
49-
Name: fieldname.Version,
50-
MarkdownDescription: "[Version of the ngrok config file](https://ngrok.com/docs/ngrok-agent/config#version). Required field for configuration file-based authentication.",
51-
Optional: false,
52-
Composition: &schema.ValueComposition{
53-
Length: 1,
54-
Charset: schema.Charset{
55-
Digits: true,
56-
},
57-
},
58-
},
5948
},
6049
DefaultProvisioner: provision.TempFile(ngrokConfig, provision.Filename("config.yml"), provision.AddArgs("--config", "{{ .Path }}")),
6150
Importer: importer.TryAll(
@@ -73,7 +62,7 @@ func ngrokConfig(in sdk.ProvisionInput) ([]byte, error) {
7362
config := Config{
7463
AuthToken: in.ItemFields[fieldname.AuthToken],
7564
APIKey: in.ItemFields[fieldname.APIKey],
76-
Version: in.ItemFields[fieldname.Version],
65+
Version: "2", // required field for ngrok CLI to work when file-based configuration is used; automatically configured by the CLI program and is not configurable by the user
7766
}
7867
contents, err := yaml.Marshal(&config)
7968
if err != nil {
@@ -103,7 +92,6 @@ func TryngrokConfigFile(path string) sdk.Importer {
10392
Fields: map[sdk.FieldName]string{
10493
fieldname.AuthToken: config.AuthToken,
10594
fieldname.APIKey: config.APIKey,
106-
fieldname.Version: config.Version,
10795
},
10896
})
10997
})
@@ -112,5 +100,5 @@ func TryngrokConfigFile(path string) sdk.Importer {
112100
type Config struct {
113101
AuthToken string `yaml:"authtoken"`
114102
APIKey string `yaml:"api_key"`
115-
Version string `yaml:"version"`
103+
Version string
116104
}

plugins/ngrok/credentials_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ func TestCredentialsProvisioner(t *testing.T) {
1414
ItemFields: map[sdk.FieldName]string{
1515
fieldname.AuthToken: "uSuQ7LUOJLs4xRbIySZ15F4v5KxfTnMknMdFEXAMPLE",
1616
fieldname.APIKey: "L4STpMP3K8FNaQjBo5EAsXA2SThzq0J7BKD3jUZgtEXAMPLE",
17-
fieldname.Version: "2",
1817
},
1918
CommandLine: []string{"ngrok"},
2019
ExpectedOutput: sdk.ProvisionOutput{
@@ -55,7 +54,6 @@ func TestCredentialsImporter(t *testing.T) {
5554
Fields: map[sdk.FieldName]string{
5655
fieldname.AuthToken: "uSuQ7LUOJLs4xRbIySZ15F4v5KxfTnMknMdFEXAMPLE",
5756
fieldname.APIKey: "L4STpMP3K8FNaQjBo5EAsXA2SThzq0J7BKD3jUZgtEXAMPLE",
58-
fieldname.Version: "2",
5957
},
6058
},
6159
},
@@ -70,7 +68,6 @@ func TestCredentialsImporter(t *testing.T) {
7068
Fields: map[sdk.FieldName]string{
7169
fieldname.AuthToken: "uSuQ7LUOJLs4xRbIySZ15F4v5KxfTnMknMdFEXAMPLE",
7270
fieldname.APIKey: "L4STpMP3K8FNaQjBo5EAsXA2SThzq0J7BKD3jUZgtEXAMPLE",
73-
fieldname.Version: "2",
7471
},
7572
},
7673
},

sdk/schema/fieldname/names.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const (
4343
URL = sdk.FieldName("URL")
4444
User = sdk.FieldName("User")
4545
Username = sdk.FieldName("Username")
46-
Version = sdk.FieldName("Version")
4746
Website = sdk.FieldName("Website")
4847
)
4948

@@ -88,7 +87,6 @@ func ListAll() []sdk.FieldName {
8887
URL,
8988
User,
9089
Username,
91-
Version,
9290
Website,
9391
}
9492
}

0 commit comments

Comments
 (0)