Initial commit
This commit is contained in:
23
config/config.go
Normal file
23
config/config.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// 配置变量
|
||||
var (
|
||||
BaseURL = getEnv("JWTS_BASE_URL", "http://jwts.hitwh.edu.cn")
|
||||
Username = getEnv("JWTS_USERNAME", "")
|
||||
Password = getEnv("JWTS_PASSWORD", "")
|
||||
Semester = getEnv("JWTS_SEMESTER", "2025-20262")
|
||||
TWFID = getEnv("JWTS_TWFID", "")
|
||||
)
|
||||
|
||||
// getEnv 从环境变量获取配置,提供默认值
|
||||
func getEnv(key, defaultValue string) string {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
return value
|
||||
}
|
||||
Reference in New Issue
Block a user