platform
This commit is contained in:
+3
-10
@@ -19,6 +19,7 @@ import (
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/profile"
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/proxy"
|
||||
"git.k6n.net/mats/go-cart-actor/pkg/telemetry"
|
||||
"git.k6n.net/mats/platform/config"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
@@ -88,18 +89,10 @@ func loadUCPProfileSigner() *ucp.SigningConfig {
|
||||
return cfg
|
||||
}
|
||||
|
||||
// getEnv returns the value of the environment variable named by key, or def if unset/empty.
|
||||
func getEnv(key, def string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
func main() {
|
||||
reg := profile.NewProfileMutationRegistry()
|
||||
|
||||
profileDir := getEnv("PROFILE_DIR", "data/profiles")
|
||||
profileDir := config.EnvString("PROFILE_DIR", "data/profiles")
|
||||
if err := os.MkdirAll(profileDir, 0755); err != nil {
|
||||
log.Printf("warning: could not create profile data directory %s: %v", profileDir, err)
|
||||
}
|
||||
@@ -214,7 +207,7 @@ func main() {
|
||||
})
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: getEnv("PROFILE_ADDR", ":8080"),
|
||||
Addr: config.EnvString("PROFILE_ADDR", ":8080"),
|
||||
BaseContext: func(net.Listener) context.Context { return ctx },
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 20 * time.Second,
|
||||
|
||||
Reference in New Issue
Block a user