Allow to preload models before startup via env var or configs

This commit is contained in:
mudler 2023-05-27 08:40:00 +02:00
parent 835a20610b
commit 30bd037264
4 changed files with 112 additions and 38 deletions

View file

@ -15,6 +15,8 @@ type Option struct {
debug, disableMessage bool
imageDir string
cors bool
preloadJSONModels string
preloadModelsFromPath string
corsAllowOrigins string
}
@ -53,6 +55,17 @@ func WithContext(ctx context.Context) AppOption {
}
}
func WithYAMLConfigPreload(configFile string) AppOption {
return func(o *Option) {
o.preloadModelsFromPath = configFile
}
}
func WithJSONStringPreload(configFile string) AppOption {
return func(o *Option) {
o.preloadJSONModels = configFile
}
}
func WithConfigFile(configFile string) AppOption {
return func(o *Option) {
o.configFile = configFile