mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 00:40:25 +02:00
zero/healthchecks: add checks for ability to save bootstrap parameter and bundle status reporting (#5064)
This commit is contained in:
parent
25aceea626
commit
dc7820ea3e
5 changed files with 33 additions and 69 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
"github.com/pomerium/pomerium/pkg/health"
|
||||
cluster_api "github.com/pomerium/pomerium/pkg/zero/cluster"
|
||||
)
|
||||
|
||||
|
@ -40,6 +41,16 @@ func LoadBootstrapConfigFromFile(fp string, cipher cipher.AEAD) (*cluster_api.Bo
|
|||
|
||||
// SaveBootstrapConfigToFile saves the bootstrap configuration to a file.
|
||||
func SaveBootstrapConfigToFile(src *cluster_api.BootstrapConfig, fp string, cipher cipher.AEAD) error {
|
||||
err := saveBootstrapConfigToFile(src, fp, cipher)
|
||||
if err != nil {
|
||||
health.ReportError(health.ZeroBootstrapConfigSave, err)
|
||||
} else {
|
||||
health.ReportOK(health.ZeroBootstrapConfigSave)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func saveBootstrapConfigToFile(src *cluster_api.BootstrapConfig, fp string, cipher cipher.AEAD) error {
|
||||
plaintext, err := json.Marshal(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("marshal file config: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue