Skip to content

Commit

Permalink
chore: Document wasmcloud package
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <joonas@cosmonic.com>
  • Loading branch information
joonas committed Sep 25, 2024
1 parent 3aefcdc commit a37a83b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wasmcloud/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package wasmcloud

import "go.wasmcloud.dev/component/gen/wasi/config/runtime"

// GetConfigOrDefault tries to get a configuration value by provided key using
// [wasi:config/store.get] and falling back to the provided defaultValue if a
// configuration value by provided key is not found.
//
// [wasi:config/store.get]: https://github.com/WebAssembly/wasi-runtime-config/blob/f4d699bc6dd77adad99fa1a2246d482225ec6485/wit/store.wit#L17-L24
func GetConfigOrDefault(key string, defaultValue string) string {
res := runtime.Get(key)
if res.IsOK() {
Expand Down
2 changes: 2 additions & 0 deletions wasmcloud/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"go.wasmcloud.dev/component/gen/wasmcloud/secrets/store"
)

// SecretGetAndReveal attempts to access a secret identified by the provided key
// and reveal it, returning the stored value as a slice of bytes.
func SecretGetAndReveal(key string) ([]byte, error) {
res := store.Get(key)
if res.IsErr() {
Expand Down

0 comments on commit a37a83b

Please sign in to comment.