feat: allow production provider bootstrap

This commit is contained in:
inman committed 2026-08-18 00:36:05 +08:00
1 parent 6480e503eb
commit 22fc7a56d8
21 files changed
+192 -18

No files matched your search

+19 -2
View File
@@ -97,7 +97,7 @@ func LoadEnvironment(path string, environment map[string]string) (map[string]str
}
merged := cloneStrings(environment)
for key, value := range file {
if _, allowed := fieldIndex[key]; !allowed {
if !allowedEnvironmentKey(key) {
continue
}
if _, exists := merged[key]; !exists {
@@ -108,14 +108,25 @@ func LoadEnvironment(path string, environment map[string]string) (map[string]str
}
func RuntimeSettingKeys() []string {
keys := make([]string, 0, len(fieldIndex))
keys := make([]string, 0, len(fieldIndex)+len(runtimeOnlyKeys))
for key := range fieldIndex {
keys = append(keys, key)
}
for key := range runtimeOnlyKeys {
keys = append(keys, key)
}
sort.Strings(keys)
return keys
}
func allowedEnvironmentKey(key string) bool {
if _, allowed := fieldIndex[key]; allowed {
return true
}
_, allowed := runtimeOnlyKeys[key]
return allowed
}
func (s *Service) WithBillingAccountWriter(writer BillingAccountWriter) *Service {
s.billing = writer
return s
@@ -483,3 +494,9 @@ var fieldIndex = func() map[string]Field {
result["VIDEO_GENERATE_ENGINE"] = Field{Key: "VIDEO_GENERATE_ENGINE", Label: "视频生成", Type: "select", DefaultValue: "bailian", Options: []Option{{Label: "Seedance", Value: "seedance"}, {Label: "阿里云百炼 Wan 2.7", Value: "bailian"}}}
return result
}()
// runtimeOnlyKeys are read from the process/settings file by the Go startup
// loader but are intentionally not exposed as editable settings-panel fields.
var runtimeOnlyKeys = map[string]struct{}{
"ZHINIAN_ALLOW_UNCONFIGURED_PROVIDERS": {},
}