切换股票数据源为 Tushare
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
const defaultTushareToken = "76efd8465f9f2591aa42a385268e06acf6b80b7a15be2267ad2281b7"
|
||||
|
||||
type Config struct {
|
||||
DatabaseURL string
|
||||
JWTSecret string
|
||||
@@ -18,8 +20,7 @@ type Config struct {
|
||||
AllowedOrigins []string
|
||||
|
||||
// 股票数据源
|
||||
TickFlowAPIKey string
|
||||
TickFlowBaseURL string
|
||||
TushareToken string
|
||||
DataSyncEnabled bool
|
||||
DataSyncTime string // HH:MM
|
||||
DataSyncWeekdays bool
|
||||
@@ -57,14 +58,9 @@ func Load() (*Config, error) {
|
||||
}
|
||||
}
|
||||
|
||||
tickFlowAPIKey := os.Getenv("TICKFLOW_API_KEY")
|
||||
if tickFlowAPIKey == "" {
|
||||
tickFlowAPIKey = "tk_94a20304993f45b5b0e376b9767597cc"
|
||||
}
|
||||
|
||||
tickFlowBaseURL := os.Getenv("TICKFLOW_BASE_URL")
|
||||
if tickFlowBaseURL == "" {
|
||||
tickFlowBaseURL = "https://api.tickflow.org"
|
||||
tushareToken := os.Getenv("TUSHARE_TOKEN")
|
||||
if tushareToken == "" {
|
||||
tushareToken = defaultTushareToken
|
||||
}
|
||||
|
||||
dataSyncEnabled := strings.ToLower(os.Getenv("DATA_SYNC_ENABLED")) != "false"
|
||||
@@ -80,8 +76,7 @@ func Load() (*Config, error) {
|
||||
JWTExpirationHours: expHours,
|
||||
Port: port,
|
||||
AllowedOrigins: allowedOrigins,
|
||||
TickFlowAPIKey: tickFlowAPIKey,
|
||||
TickFlowBaseURL: tickFlowBaseURL,
|
||||
TushareToken: tushareToken,
|
||||
DataSyncEnabled: dataSyncEnabled,
|
||||
DataSyncTime: dataSyncTime,
|
||||
DataSyncWeekdays: dataSyncWeekdays,
|
||||
|
||||
Reference in New Issue
Block a user