26 lines
508 B
Go
26 lines
508 B
Go
package config
|
|
|
|
import (
|
|
"github.com/joho/godotenv"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
TencentSecretID string
|
|
TencentSecretKey string
|
|
GeminiAPIKey string
|
|
APIKey string
|
|
}
|
|
|
|
func LoadConfig() (*Config, error) {
|
|
if err := godotenv.Load(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &Config{
|
|
TencentSecretID: os.Getenv("TENCENT_SECRET_ID"),
|
|
TencentSecretKey: os.Getenv("TENCENT_SECRET_KEY"),
|
|
GeminiAPIKey: os.Getenv("GEMINI_API_KEY"),
|
|
APIKey: os.Getenv("API_KEY"),
|
|
}, nil
|
|
} |