diff options
-rw-r--r-- | internal/server/server.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/server/server.go b/internal/server/server.go index 05b1d2a..9781364 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -109,6 +109,9 @@ func New(runtimeConfig *Config) (*Server, error) { if err != nil { return nil, errors.WithMessage(err, "error parsing configuration file") } + if runtimeConfig.Development { + applyDevModeOverrides(config, runtimeConfig.ListenAddress) + } listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, strconv.Itoa(runtimeConfig.Port)) top := http.NewServeMux() @@ -119,9 +122,12 @@ func New(runtimeConfig *Config) (*Server, error) { Development: runtimeConfig.Development, } - if runtimeConfig.Development { - applyDevModeOverrides(config, listenAddress) + err = rebuild(builderConfig, config) + if err != nil { + return nil, err + } + if runtimeConfig.Development { liveReload := livereload.New() top.Handle("/_/reload", liveReload) liveReload.Start() @@ -152,11 +158,6 @@ func New(runtimeConfig *Config) (*Server, error) { }) } - err = rebuild(builderConfig, config) - if err != nil { - return nil, err - } - loggingMux := http.NewServeMux() mux, err := website.NewMux(config, runtimeConfig.Root) if err != nil { |