-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
observeAuthMode: read from default config instead of hardcoding
Signed-off-by: Peter Hunt <[email protected]>
- Loading branch information
1 parent
5b58ad8
commit c509f79
Showing
5 changed files
with
66 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package bindata | ||
|
||
import ( | ||
"bytes" | ||
"encoding/json" | ||
"fmt" | ||
"path/filepath" | ||
|
||
kyaml "k8s.io/apimachinery/pkg/util/yaml" | ||
) | ||
|
||
func UnstructuredDefaultConfig() (map[string]any, error) { | ||
asset := filepath.Join("assets", "config", "defaultconfig.yaml") | ||
raw, err := Asset(asset) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get default config asset asset=%s - %s", asset, err) | ||
} | ||
|
||
rawJSON, err := kyaml.ToJSON(raw) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to convert asset yaml to JSON asset=%s - %s", asset, err) | ||
} | ||
|
||
return ConvertToUnstructured(rawJSON) | ||
} | ||
|
||
func ConvertToUnstructured(raw []byte) (map[string]interface{}, error) { | ||
decoder := json.NewDecoder(bytes.NewBuffer(raw)) | ||
u := map[string]interface{}{} | ||
if err := decoder.Decode(&u); err != nil { | ||
return nil, err | ||
} | ||
|
||
return u, nil | ||
} |
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