24 lines
378 B
Go
24 lines
378 B
Go
package context
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ekzyis/echo-htmx-templ-tailwindcss/env"
|
|
)
|
|
|
|
type ContextKey string
|
|
|
|
var (
|
|
Env ContextKey = "env"
|
|
Session ContextKey = "session"
|
|
Commit ContextKey = "commit"
|
|
Origin ContextKey = "origin"
|
|
)
|
|
|
|
func GetOrigin(ctx context.Context) string {
|
|
if u, ok := ctx.Value(Origin).(string); ok {
|
|
return u
|
|
}
|
|
return env.PublicUrl
|
|
}
|