Skip to content

Commit

Permalink
Merge pull request #50 from ConductorOne/shackra/update-baton-sdk-ver…
Browse files Browse the repository at this point in the history
…sion

Update baton-sdk and place constraints
  • Loading branch information
ggreer authored Jul 22, 2024
2 parents 7b9f1e7 + 3e9447b commit a7b669a
Show file tree
Hide file tree
Showing 20 changed files with 647 additions and 112 deletions.
12 changes: 3 additions & 9 deletions cmd/baton-ldap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,16 @@ var configurationFields = []field.SchemaField{

var configRelations = []field.SchemaFieldRelationship{
field.FieldsMutuallyExclusive(domainField, urlField),
field.FieldsAtLeastOneUsed(domainField, urlField),
}

var configuration = field.NewConfiguration(configurationFields, configRelations...)

// validateConfig is run after the configuration is loaded, and should return an error if it isn't valid.
func validateConfig(ctx context.Context, v *viper.Viper) error {
l := ctxzap.Extract(ctx)

domain := v.GetString(domainField.FieldName)
urlstr := v.GetString(urlField.FieldName)
if domain == "" && urlstr == "" {
return fmt.Errorf("domain or url is required")
}

if domain != "" && urlstr != "" {
return fmt.Errorf("only one of domain or url is allowed")
}

if urlstr != "" {
_, err := url.Parse(urlstr)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/baton-ldap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var version = "dev"
func main() {
ctx := context.Background()

_, cmd, err := configschema.DefineConfiguration(ctx, "baton-ldap", getConnector, configurationFields, configRelations)
_, cmd, err := configschema.DefineConfiguration(ctx, "baton-ldap", getConnector, configuration)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.22.3

require (
github.com/conductorone/baton-sdk v0.2.1
github.com/conductorone/baton-sdk v0.2.7
github.com/go-ldap/ldap/v3 v3.4.5
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/jackc/puddle/v2 v2.2.1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-sdk v0.2.0 h1:aynxpdTHok/MTiHBWqWV32ptmMWUky3X7NEcG76ipMM=
github.com/conductorone/baton-sdk v0.2.0/go.mod h1:cg5FyUcJnD7xK5SPbHe/KNpwUVVlpHJ9rnmd3UwxSkU=
github.com/conductorone/baton-sdk v0.2.1 h1:Ft46eoVFO3q3Op/G65dcqubZe2pw/44GcpD+KnaVyq8=
github.com/conductorone/baton-sdk v0.2.1/go.mod h1:cg5FyUcJnD7xK5SPbHe/KNpwUVVlpHJ9rnmd3UwxSkU=
github.com/conductorone/baton-sdk v0.2.7 h1:mzp7H0zVeZLMvdGj3Yx31mpzM6ytNKI6QmpzRuiPlVE=
github.com/conductorone/baton-sdk v0.2.7/go.mod h1:cg5FyUcJnD7xK5SPbHe/KNpwUVVlpHJ9rnmd3UwxSkU=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a7b669a

Please sign in to comment.