-
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.
Add option to skip unavailable databases.
- Loading branch information
Showing
7 changed files
with
20 additions
and
32 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
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,28 +1,17 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/conductorone/baton-sdk/pkg/field" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
var ( | ||
dsn = field.StringField("dsn", | ||
field.WithDescription("The connection string for connecting to SQL Server"), | ||
field.WithRequired(true)) | ||
skipUnavailableDatabases = field.BoolField("skip-unavailable-databases", | ||
field.WithDescription("Skip databases that are unavailable (offline, restoring, etc)")) | ||
) | ||
|
||
var cfg = field.Configuration{ | ||
Fields: []field.SchemaField{dsn}, | ||
} | ||
|
||
// validateConfig is run after the configuration is loaded, and should return an error if it isn't valid. | ||
func validateConfig(_ context.Context, v *viper.Viper) error { | ||
if v.GetString(dsn.FieldName) == "" { | ||
return fmt.Errorf("--dsn is required") | ||
} | ||
|
||
return nil | ||
Fields: []field.SchemaField{dsn, skipUnavailableDatabases}, | ||
} |
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
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