Files
llink/go/internal/utils/env.go
T
Arjun Patel d262f734f0 Mobile notifications for iOS (#210)
* mobile: wire notification registration and listener

* implement backend components for push notifications

* refactor: agentic comment cleanup

* docs: use proper module name for particle processor

* set required env variables for push notifications

* bump version

* fix: always upsert push token on mobile start

* Revert "fix: always upsert push token on mobile start"

This reverts commit 90ff18a788.

* send push notifications regardless of online status
2026-05-18 12:44:31 -07:00

34 lines
692 B
Go

package utils
import (
"os"
"github.com/sirupsen/logrus"
)
// EnvVar enumerates the env vars referenced via this package.
type EnvVar string
const ()
// MustGetEnv panics if the variable is unset.
func MustGetEnv[T string | EnvVar](key T) string {
keyString := string(key)
value := os.Getenv(keyString)
if value == "" {
logrus.Errorf("Missing required environment variable %s", key)
panic("Missing required environment variable")
}
return value
}
// GetEnv returns "" if the variable is unset (and logs a warning).
func GetEnv(key string) string {
value := os.Getenv(key)
if value == "" {
logrus.Warnf("Missing optional environment variable %s", key)
}
return value
}