Skip to content

Commit

Permalink
Use consistent config
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal committed Jan 29, 2025
1 parent 26a3fa0 commit 2c40260
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions client/embed/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,17 @@ func New(opts Options) (*Client, error) {
t := true
var config *internal.Config
var err error
input := internal.ConfigInput{
ConfigPath: opts.ConfigPath,
ManagementURL: opts.ManagementURL,
PreSharedKey: &opts.PreSharedKey,
DisableServerRoutes: &t,
DisableClientRoutes: &opts.DisableClientRoutes,
}
if opts.ConfigPath != "" {
config, err = internal.UpdateOrCreateConfig(internal.ConfigInput{
ConfigPath: opts.ConfigPath,
ManagementURL: opts.ManagementURL,
PreSharedKey: &opts.PreSharedKey,
DisableServerRoutes: &t,
DisableClientRoutes: &opts.DisableClientRoutes,
})
config, err = internal.UpdateOrCreateConfig(input)
} else {
config, err = internal.CreateInMemoryConfig(internal.ConfigInput{
ManagementURL: opts.ManagementURL,
PreSharedKey: &opts.PreSharedKey,
DisableServerRoutes: &t,
})
config, err = internal.CreateInMemoryConfig(input)
}
if err != nil {
return nil, fmt.Errorf("create config: %w", err)
Expand Down

0 comments on commit 2c40260

Please sign in to comment.