@@ -46,7 +46,7 @@ type App struct {
4646 Name string
4747 CustomLayout bool
4848
49- Config * apptype.AppConfig
49+ codeConfig * apptype.CodeConfig
5050 sourceFS * appfs.SourceFs
5151 initMutex sync.Mutex
5252 initialized bool
@@ -73,7 +73,7 @@ type App struct {
7373 sseListeners []chan SSEMessage
7474 funcMap template.FuncMap
7575 starlarkCache map [string ]* starlarkCacheEntry
76- appDefaults types.AppDefaults
76+ appConfig types.AppConfig
7777}
7878
7979type starlarkCacheEntry struct {
@@ -88,7 +88,7 @@ type SSEMessage struct {
8888
8989func NewApp (sourceFS * appfs.SourceFs , workFS * appfs.WorkFs , logger * types.Logger ,
9090 appEntry * types.AppEntry , systemConfig * types.SystemConfig ,
91- plugins map [string ]types.PluginSettings , appDefaults types.AppDefaults ) (* App , error ) {
91+ plugins map [string ]types.PluginSettings , appConfig types.AppConfig ) (* App , error ) {
9292 newApp := & App {
9393 sourceFS : sourceFS ,
9494 Logger : logger ,
@@ -97,8 +97,8 @@ func NewApp(sourceFS *appfs.SourceFs, workFS *appfs.WorkFs, logger *types.Logger
9797 starlarkCache : map [string ]* starlarkCacheEntry {},
9898 }
9999 newApp .plugins = NewAppPlugins (newApp , plugins , appEntry .Metadata .Accounts )
100- newApp .appDefaults = appDefaults
101- if err := newApp .updateAppDefaults (); err != nil {
100+ newApp .appConfig = appConfig
101+ if err := newApp .updateAppConfig (); err != nil {
102102 return nil , err
103103 }
104104
@@ -213,16 +213,16 @@ func (a *App) Reload(force, immediate bool, dryRun DryRun) (bool, error) {
213213
214214 // Config lock is not present, use default config
215215 a .Debug ().Msg ("No config lock file found, using default config" )
216- a .Config = apptype .NewAppConfig ()
216+ a .codeConfig = apptype .NewCodeConfig ()
217217 if a .IsDev {
218- a .appDev .Config = a .Config
218+ a .appDev .Config = a .codeConfig
219219 a .appDev .SaveConfigLockFile ()
220220 }
221221 } else {
222222 // Config lock file is present, read defaults from that
223223 a .Debug ().Msg ("Config lock file found, using config from lock file" )
224- a .Config = apptype .NewCompatibleAppConfig ()
225- if err := json .Unmarshal (configData , a .Config ); err != nil {
224+ a .codeConfig = apptype .NewCompatibleCodeConfig ()
225+ if err := json .Unmarshal (configData , a .codeConfig ); err != nil {
226226 return false , err
227227 }
228228 }
@@ -234,7 +234,7 @@ func (a *App) Reload(force, immediate bool, dryRun DryRun) (bool, error) {
234234
235235 if a .IsDev {
236236 // Copy settings into appdev
237- a .appDev .Config = a .Config
237+ a .appDev .Config = a .codeConfig
238238 a .appDev .CustomLayout = a .CustomLayout
239239
240240 // Initialize style configuration
@@ -273,14 +273,14 @@ func (a *App) Reload(force, immediate bool, dryRun DryRun) (bool, error) {
273273
274274 // Parse HTML templates if there are HTML routes
275275 if a .usesHtmlTemplate {
276- baseFiles , err := a .sourceFS .Glob (path .Join (a .Config .Routing .BaseTemplates , "*.go.html" ))
276+ baseFiles , err := a .sourceFS .Glob (path .Join (a .codeConfig .Routing .BaseTemplates , "*.go.html" ))
277277 if err != nil {
278278 return false , err
279279 }
280280
281281 if len (baseFiles ) == 0 {
282282 // No base templates found, use the default unstructured templates
283- if a .template , err = a .sourceFS .ParseFS (a .funcMap , a .Config .Routing .TemplateLocations ... ); err != nil {
283+ if a .template , err = a .sourceFS .ParseFS (a .funcMap , a .codeConfig .Routing .TemplateLocations ... ); err != nil {
284284 return false , err
285285 }
286286 } else {
@@ -291,7 +291,7 @@ func (a *App) Reload(force, immediate bool, dryRun DryRun) (bool, error) {
291291 }
292292
293293 a .templateMap = make (map [string ]* template.Template )
294- for _ , paths := range a .Config .Routing .TemplateLocations {
294+ for _ , paths := range a .codeConfig .Routing .TemplateLocations {
295295 files , err := a .sourceFS .Glob (paths )
296296 if err != nil {
297297 return false , err
@@ -702,18 +702,18 @@ func (a *App) loadStarlark(thread *starlark.Thread, module string, cache map[str
702702 return cacheEntry .globals , cacheEntry .err
703703}
704704
705- // updateAppDefaults updates the app defaults from the metadata
705+ // updateAppConfig updates the app defaults from the metadata
706706// It creates a TOML intermediate string so that the TOML parsing can be used
707- func (a * App ) updateAppDefaults () error {
708- if len (a .Metadata .AppDefaults ) == 0 {
707+ func (a * App ) updateAppConfig () error {
708+ if len (a .Metadata .AppConfig ) == 0 {
709709 return nil
710710 }
711711
712712 buf := strings.Builder {}
713- for key , value := range a .Metadata .AppDefaults {
713+ for key , value := range a .Metadata .AppConfig {
714714 buf .WriteString (fmt .Sprintf ("%s=\" %s\" \n " , key , value ))
715715 }
716716
717- _ , err := toml .Decode (buf .String (), & a .appDefaults )
717+ _ , err := toml .Decode (buf .String (), & a .appConfig )
718718 return err
719719}
0 commit comments