- config.go: AuthAPIKey 默认值从空字符串恢复为 xn001624. - index.html: 引入 marked.js,支持 .md/.markdown 文件渲染预览 - 新增 markdown 预览类型,自动获取内容并渲染为 HTML - 文件图标识别 md 文件显示为代码文件图标 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
797 B
Go
31 lines
797 B
Go
package common
|
|
|
|
import "os"
|
|
|
|
type Config struct {
|
|
RustFSEndpoint string
|
|
RustFSAccessKeyID string
|
|
RustFSSecretAccessKey string
|
|
RustFSRegion string
|
|
ServerPort string
|
|
AuthAPIKey string
|
|
}
|
|
|
|
func LoadConfig() *Config {
|
|
return &Config{
|
|
RustFSEndpoint: getEnv("RUSTFS_ENDPOINT_URL", "http://192.168.1.154:9000"),
|
|
RustFSAccessKeyID: getEnv("RUSTFS_ACCESS_KEY_ID", ""),
|
|
RustFSSecretAccessKey: getEnv("RUSTFS_SECRET_ACCESS_KEY", ""),
|
|
RustFSRegion: getEnv("RUSTFS_REGION", "us-east-1"),
|
|
ServerPort: getEnv("SERVER_PORT", "8080"),
|
|
AuthAPIKey: getEnv("AUTH_API_KEY", "xn001624."),
|
|
}
|
|
}
|
|
|
|
func getEnv(key, fallback string) string {
|
|
if value, ok := os.LookupEnv(key); ok {
|
|
return value
|
|
}
|
|
return fallback
|
|
}
|