fix: load .env file with godotenv for config

This commit is contained in:
2026-05-05 11:56:23 +08:00
parent d2b20a9f91
commit aad37d843e
3 changed files with 55 additions and 16 deletions
+6 -1
View File
@@ -1,6 +1,10 @@
package config
import "os"
import (
"os"
"github.com/joho/godotenv"
)
type Config struct {
OpenAIAPIKey string
@@ -12,6 +16,7 @@ type Config struct {
}
func Load() *Config {
_ = godotenv.Load()
return &Config{
OpenAIAPIKey: getEnv("OPENAI_API_KEY", ""),
OpenAIBaseURL: getEnv("OPENAI_BASE_URL", "https://api.openai.com/v1"),