mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-09 12:58:22 +02:00
restructure
This commit is contained in:
parent
40efa26257
commit
c7fd5a4752
7 changed files with 86 additions and 122 deletions
|
@ -4,30 +4,21 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pomerium/pomerium/config"
|
||||
cluster_api "github.com/pomerium/zero-sdk/cluster"
|
||||
)
|
||||
|
||||
// LoadBootstrapConfigFromAPI loads the bootstrap configuration from the cluster API.
|
||||
func LoadBootstrapConfigFromAPI(
|
||||
ctx context.Context,
|
||||
dst *config.Options,
|
||||
client cluster_api.ClientWithResponsesInterface,
|
||||
) error {
|
||||
) (*cluster_api.BootstrapConfig, error) {
|
||||
resp, err := client.GetClusterBootstrapConfigWithResponse(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get: %w", err)
|
||||
return nil, fmt.Errorf("get: %w", err)
|
||||
}
|
||||
if resp.JSON200 == nil {
|
||||
return fmt.Errorf("unexpected response: %d/%v", resp.StatusCode(), resp.Status())
|
||||
return nil, fmt.Errorf("unexpected response: %d/%v", resp.StatusCode(), resp.Status())
|
||||
}
|
||||
|
||||
v := cluster_api.BootstrapConfig(*resp.JSON200)
|
||||
|
||||
if v.DatabrokerStorageConnection != nil {
|
||||
dst.DataBrokerStorageType = "postgres"
|
||||
dst.DataBrokerStorageConnectionString = *v.DatabrokerStorageConnection
|
||||
}
|
||||
|
||||
return nil
|
||||
return resp.JSON200, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue