diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/server/server.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/server/server.go b/internal/server/server.go index 9dcf09f..890569c 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "slices" "strconv" "strings" @@ -97,6 +98,12 @@ func rebuild(builderConfig *builder.IOConfig, config *cfg.Config) error { } func New(runtimeConfig *Config) (*Server, error) { + builderConfig := &builder.IOConfig{ + Source: "content", + Destination: runtimeConfig.Root, + Development: runtimeConfig.Development, + } + if !runtimeConfig.Development { vcsConfig := &vcs.Config{} _, err := conf.Parse("", vcsConfig) @@ -111,7 +118,12 @@ func New(runtimeConfig *Config) (*Server, error) { if err != nil { return nil, err } - runtimeConfig.Root = "public" + + builderConfig.Source = filepath.Join(vcsConfig.LocalPath, "content") + + publicDir := filepath.Join(runtimeConfig.Root, "public") + builderConfig.Destination = publicDir + runtimeConfig.Root = publicDir } config, err := cfg.GetConfig() @@ -125,12 +137,6 @@ func New(runtimeConfig *Config) (*Server, error) { listenAddress := net.JoinHostPort(runtimeConfig.ListenAddress, strconv.Itoa(runtimeConfig.Port)) top := http.NewServeMux() - builderConfig := &builder.IOConfig{ - Source: "content", - Destination: runtimeConfig.Root, - Development: runtimeConfig.Development, - } - err = rebuild(builderConfig, config) if err != nil { return nil, err |