forked from authzed/spicedb
-
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 certificate path option for YDB (#13)
- Loading branch information
1 parent
04604b9
commit a1e48fc
Showing
8 changed files
with
110 additions
and
56 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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package migrations | ||
|
||
type ydbConfig struct { | ||
tablePathPrefix string | ||
certificatePath string | ||
} | ||
|
||
var defaultConfig = ydbConfig{} | ||
|
||
// Option provides the facility to configure how clients within the YDB | ||
// datastore interact with the running YDB database. | ||
type Option func(*ydbConfig) | ||
|
||
func generateConfig(options []Option) *ydbConfig { | ||
computed := defaultConfig | ||
for _, option := range options { | ||
option(&computed) | ||
} | ||
|
||
return &computed | ||
} | ||
|
||
// WithTablePathPrefix sets table prefix that will be implicitly added to all YDB queries. | ||
// See https://ydb.tech/docs/en/yql/reference/syntax/pragma#table-path-prefix for details. | ||
// | ||
// Default is empty. | ||
// Non-empty DSN parameter takes precedence over this option. | ||
func WithTablePathPrefix(prefix string) Option { | ||
return func(o *ydbConfig) { o.tablePathPrefix = prefix } | ||
} | ||
|
||
// WithCertificatePath sets a path to the certificate to use when connecting to YDB with grpcs protocol. | ||
// Default is empty. | ||
func WithCertificatePath(path string) Option { | ||
return func(o *ydbConfig) { o.certificatePath = path } | ||
} |
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