Skip to content

Commit

Permalink
updated hello-world app to include env var in route
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Oct 24, 2023
1 parent 44f051c commit d9f94d9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion efs/hello-world/components/backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func main() {
}

func sayWho(k kit.Kontext) error {
who := k.EnvDef("HELLO_WORLD_WHO", "World")
who := k.EnvDef("who", "World")
k.Log().Infof("The who is '%s'!", who)

return k.Resp().SendStr(who)
Expand Down
2 changes: 1 addition & 1 deletion efs/hello-world/components/frontend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func main() {
k := kit.New()
k.Route("Path(`/hello`)", sayHello)
k.Route("Path(`/{{.Env.subPath}}/hello`)", sayHello)
k.Start()
}

Expand Down
3 changes: 2 additions & 1 deletion efs/hello-world/hack/environments/universe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ metadata:
name: universe
spec:
vars:
HELLO_WORLD_WHO: Universe
subPath: big
who: Universe
3 changes: 2 additions & 1 deletion efs/hello-world/hack/environments/world.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ metadata:
name: world
spec:
vars:
HELLO_WORLD_WHO: World
subPath: small
who: World
2 changes: 1 addition & 1 deletion internal/kubernetes/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (c *Client) PortForward(ctx context.Context, req *PortForwardRequest) (*Por

go func() {
if err := pfer.ForwardPorts(); err != nil {
log.Fatal("Error starting port forward: %v", err)
log.Fatal("Error with port forward: %v", err)
}
}()

Expand Down

0 comments on commit d9f94d9

Please sign in to comment.