price pipeline
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
d7ec1fb355
commit
d9581d7f7e
16 changed files with 790 additions and 10 deletions
|
|
@ -1,18 +1,34 @@
|
|||
package config
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DatabaseURL string
|
||||
Port string
|
||||
Env string
|
||||
DatabaseURL string
|
||||
Port string
|
||||
Env string
|
||||
OpenFIGIKey string
|
||||
CoinGeckoKey string
|
||||
PriceFetchInterval time.Duration
|
||||
PriceCleanInterval time.Duration
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
fetchInterval, err := time.ParseDuration(getenv("PRICE_FETCH_INTERVAL", "1h"))
|
||||
if err != nil {
|
||||
fetchInterval = time.Hour
|
||||
}
|
||||
|
||||
return &Config{
|
||||
DatabaseURL: getenv("DATABASE_URL", "postgres://account:account@localhost:5432/account?sslmode=disable"),
|
||||
Port: getenv("PORT", "8080"),
|
||||
Env: getenv("ENV", "development"),
|
||||
DatabaseURL: getenv("DATABASE_URL", "postgres://account:account@localhost:5432/account?sslmode=disable"),
|
||||
Port: getenv("PORT", "8080"),
|
||||
Env: getenv("ENV", "development"),
|
||||
OpenFIGIKey: os.Getenv("OPENFIGI_API_KEY"),
|
||||
CoinGeckoKey: os.Getenv("COINGECKO_API_KEY"),
|
||||
PriceFetchInterval: fetchInterval,
|
||||
PriceCleanInterval: 24 * time.Hour,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue