Skip to content

Commit

Permalink
Merge pull request #54 from spiffe/feature/demo
Browse files Browse the repository at this point in the history
working demo
  • Loading branch information
v0lkan authored Nov 27, 2024
2 parents 43e94be + 2924ac1 commit 38ec9c5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions app/demo/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"context"
"fmt"

"github.com/spiffe/spike/app/demo/store"
"github.com/spiffe/spike/app/demo/spike"
"github.com/spiffe/spike/pkg/spiffe"
)

Expand All @@ -24,16 +24,12 @@ func main() {
defer spiffe.CloseSource(source)

fmt.Println("Demo app initialized")

// We cannot have assumptions about how the app SPIFFE ID is formatted.
// We need to do some form of registration on SPIKE Nexus to validate the
// SPIFFE ID.
fmt.Println("SPIFFE ID:", spiffeid)

path := "/tenants/demo/db/creds"
version := 0

secret, err := store.GetSecret(source, path, version)
secret, err := spike.GetSecret(source, path, version)
if err != nil {
fmt.Println("Error reading secret:", err.Error())
return
Expand Down
2 changes: 1 addition & 1 deletion app/demo/store/store.go → app/demo/spike/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// \\\\\ Copyright 2024-present SPIKE contributors.
// \\\\\\\ SPDX-License-Identifier: Apache-2.0

package store
package spike

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion hack/demo-create-policy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# \\\\\ Copyright 2024-present SPIKE contributors.
# \\\\\\\ SPDX-License-Identifier: Apache-2.

spike policy create --name=workload-can-read \
./spike policy create --name=workload-can-read \
--path="/tenants/demo/db/*" \
--spiffeid="^spiffe://spike.ist/workload/*" \
--permissions="read"
2 changes: 1 addition & 1 deletion hack/demo-put-secret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# \\\\\ Copyright 2024-present SPIKE contributors.
# \\\\\\\ SPDX-License-Identifier: Apache-2.

spike put /tenants/demo/db/creds \
./spike secret put /tenants/demo/db/creds \
username=admin \
password=SPIKERocks

0 comments on commit 38ec9c5

Please sign in to comment.