Skip to content

Commit

Permalink
Merge pull request #21 from ydb-platform/login-password
Browse files Browse the repository at this point in the history
CredentialsStaticLogin+CredentialsStaticPassword
  • Loading branch information
asmyasnikov authored Dec 2, 2024
2 parents 0c890ea + ce28c86 commit 1aa9dce
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Upgraded `ydb-go-sdk` dependency
* Added `CredentialsStaticLogin` and `CredentialsStaticPassword` configuration parameters (alternatively for parameter `CredentialsStatic`)

## v1.3.0
* Upgraded `ydb-go-sdk` dependency
* Set `info` as default log-level for fluent-bit ydb plugin
Expand Down
4 changes: 3 additions & 1 deletion examples/tail2ydb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# CredentialsYcServiceAccountKeyFile sa-key.json
# CredentialsYcServiceAccountKeyJson json-data
# CredentialsYcMetadata 1
# CredentialsStatic username:password@
# CredentialsStatic login:password
# CredentialsStaticLogin @login
# CredentialsStaticPassword :password
# CredentialsToken token-value
# Certificates ydb-ca.crt
LogLevel disabled # optional parameter. Value must be one of "disabled", "trace", "debug", "info", "warn", "error", "fatal" or "panic"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/rs/zerolog v1.32.0
github.com/stretchr/testify v1.8.3
github.com/surge/cityhash v0.0.0-20131128155616-cdd6a94144ab
github.com/ydb-platform/ydb-go-sdk/v3 v3.92.6
github.com/ydb-platform/ydb-go-sdk/v3 v3.93.0
github.com/ydb-platform/ydb-go-yc v0.12.1
golang.org/x/sync v0.9.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 h1:LY
github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77/go.mod h1:Er+FePu1dNUieD+XTMDduGpQuCPssK5Q4BjF+IIXJ3I=
github.com/ydb-platform/ydb-go-sdk/v3 v3.44.0/go.mod h1:oSLwnuilwIpaF5bJJMAofnGgzPJusoI3zWMNb8I+GnM=
github.com/ydb-platform/ydb-go-sdk/v3 v3.47.3/go.mod h1:bWnOIcUHd7+Sl7DN+yhyY1H/I61z53GczvwJgXMgvj0=
github.com/ydb-platform/ydb-go-sdk/v3 v3.92.6 h1:4T6B1Mv1vZiq+08Jv/J5R5ZG4ManSEeaVRPHB2FrRH4=
github.com/ydb-platform/ydb-go-sdk/v3 v3.92.6/go.mod h1:WiezFS4YCi2vHqbYGQkeu/2MDBYFLix6dIs/pd87Yck=
github.com/ydb-platform/ydb-go-sdk/v3 v3.93.0 h1:CYPlnIAd6BnYt2EKrcf+swGWqtxEO0OwwDNKOKey7Cc=
github.com/ydb-platform/ydb-go-sdk/v3 v3.93.0/go.mod h1:WiezFS4YCi2vHqbYGQkeu/2MDBYFLix6dIs/pd87Yck=
github.com/ydb-platform/ydb-go-yc v0.12.1 h1:qw3Fa+T81+Kpu5Io2vYHJOwcrYrVjgJlT6t/0dOXJrA=
github.com/ydb-platform/ydb-go-yc v0.12.1/go.mod h1:t/ZA4ECdgPWjAb4jyDe8AzQZB5dhpGbi3iCahFaNwBY=
github.com/ydb-platform/ydb-go-yc-metadata v0.6.1 h1:9E5q8Nsy2RiJMZDNVy0A3KUrIMBPakJ2VgloeWbcI84=
Expand Down
34 changes: 33 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const (
ParamCredentialsYcServiceAccountKey = "CredentialsYcServiceAccountKey"
ParamCredentialsYcMetadata = "CredentialsYcMetadata"
ParamCredentialsStatic = "CredentialsStatic"
ParamCredentialsStaticLogin = "CredentialsStaticLogin"
ParamCredentialsStaticPassword = "CredentialsStaticPassword"
ParamCredentialsToken = "CredentialsToken"
ParamCredentialsAnonymous = "CredentialsAnonymous"
ParamLogLevel = "LogLevel"
Expand Down Expand Up @@ -87,7 +89,37 @@ var credentialsChooser = map[string]credentialsDescription{
},
about: func() string {
return fmt.Sprintf(
"value of parameter '%s' must be a string with template 'user:password'",
"value of parameter %q must be a string with template 'user:password'. Alternatively parameter for splitted parameters %q and %q", //nolint:lll
ParamCredentialsStatic,
ParamCredentialsStaticLogin,
ParamCredentialsStaticPassword,
)
},
},
ParamCredentialsStaticLogin: {
make: func(value string) (ydb.Option, error) {
return ydb.WithStaticCredentialsLogin(value), nil
},
about: func() string {
return fmt.Sprintf(
"value of parameter %q must be a string with static credentials login. %q uses with %q. Alternatively you can use parameter %q", //nolint:lll
ParamCredentialsStaticLogin,
ParamCredentialsStaticLogin,
ParamCredentialsStaticPassword,
ParamCredentialsStatic,
)
},
},
ParamCredentialsStaticPassword: {
make: func(value string) (ydb.Option, error) {
return ydb.WithStaticCredentialsPassword(value), nil
},
about: func() string {
return fmt.Sprintf(
"value of parameter %q must be a string with static credentials password. %q uses with %q. Alternatively you can use parameter %q", //nolint:lll
ParamCredentialsStaticPassword,
ParamCredentialsStaticPassword,
ParamCredentialsStaticLogin,
ParamCredentialsStatic,
)
},
Expand Down

0 comments on commit 1aa9dce

Please sign in to comment.