-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use the configuration schema fields (#16)
* Update to use the configuration schema fields * Use baton-sdk from repo
- Loading branch information
Showing
120 changed files
with
9,419 additions
and
2,857 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/conductorone/baton-sdk/pkg/cli" | ||
"github.com/spf13/cobra" | ||
"github.com/conductorone/baton-sdk/pkg/field" | ||
) | ||
|
||
// config defines the external configuration required for the connector to run. | ||
type config struct { | ||
cli.BaseConfig `mapstructure:",squash"` // Puts the base config options in the same place as the connector options | ||
|
||
ApiKey string `mapstructure:"api-key"` | ||
} | ||
|
||
// validateConfig is run after the configuration is loaded, and should return an error if it isn't valid. | ||
func validateConfig(ctx context.Context, cfg *config) error { | ||
if cfg.ApiKey == "" { | ||
return fmt.Errorf("api key is missing") | ||
} | ||
|
||
return nil | ||
} | ||
var apiKey = field.StringField("api-key", field.WithRequired(true), field.WithDescription("The Linear Personal API key used to connect to the Linear API")) | ||
|
||
// cmdFlags sets the cmdFlags required for the connector. | ||
func cmdFlags(cmd *cobra.Command) { | ||
cmd.PersistentFlags().String("api-key", "", "The Linear Personal API key used to connect to the Linear API. ($BATON_API_KEY)") | ||
} | ||
var configuration = field.NewConfiguration([]field.SchemaField{apiKey}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.