diff options
author | Alan Pearce | 2024-06-29 10:40:11 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-29 10:40:11 +0200 |
commit | b0621bf7f6d2909b8573430b9a10326db586909f (patch) | |
tree | 3ee8b5da1d183c177d7f2a2786a7d787cc034a00 /internal | |
parent | 37895a7da8dfd3a2d419e62350595bd83cceb434 (diff) | |
download | website-b0621bf7f6d2909b8573430b9a10326db586909f.tar.lz website-b0621bf7f6d2909b8573430b9a10326db586909f.tar.zst website-b0621bf7f6d2909b8573430b9a10326db586909f.zip |
move public directory out of git repository
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 |