feat: initial FRED API Proxy project
- Go web server using Gin framework - Proxy FRED economic data API - Support series, observations, search, releases endpoints
This commit is contained in:
34
config/config.go
Normal file
34
config/config.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
FREDAPIKey string
|
||||
ServerPort string
|
||||
FREDBaseURL string
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
apiKey := os.Getenv("FRED_API_KEY")
|
||||
if apiKey == "" {
|
||||
apiKey = "987b9c3428a3d0fe90179e3e6298d05e"
|
||||
}
|
||||
|
||||
port := os.Getenv("SERVER_PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
|
||||
baseURL := os.Getenv("FRED_BASE_URL")
|
||||
if baseURL == "" {
|
||||
baseURL = "https://api.stlouisfed.org/fred"
|
||||
}
|
||||
|
||||
return &Config{
|
||||
FREDAPIKey: apiKey,
|
||||
ServerPort: port,
|
||||
FREDBaseURL: baseURL,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user