♻️ Updates filepaths building
/ docker (push) Successful in 1m4s Details

This commit is contained in:
Maxim Lebedev 2023-11-19 14:15:10 +06:00
parent 41dc86eb62
commit 0656fc8ca4
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
2 changed files with 8 additions and 7 deletions

View File

@ -3,15 +3,16 @@ package domain
import ( import (
"net" "net"
"net/netip" "net/netip"
"path/filepath"
"strconv" "strconv"
"testing" "testing"
) )
type Config struct { type Config struct {
ContentDir string `env:"CONTENT_DIR" envDefault:"content/"` ContentDir string `env:"CONTENT_DIR" envDefault:"content"`
Host string `env:"HOST" envDefault:"0.0.0.0"` Host string `env:"HOST" envDefault:"0.0.0.0"`
ThemeDir string `env:"THEME_DIR" envDefault:"theme/"` ThemeDir string `env:"THEME_DIR" envDefault:"theme"`
StaticDir string `env:"STATIC_DIR" envDefault:"static/"` StaticDir string `env:"STATIC_DIR" envDefault:"static"`
Port uint16 `env:"PORT" envDefault:"3000"` Port uint16 `env:"PORT" envDefault:"3000"`
} }
@ -19,10 +20,10 @@ func TestConfig(tb testing.TB) *Config {
tb.Helper() tb.Helper()
return &Config{ return &Config{
ContentDir: "testdata/content/", ContentDir: filepath.Join("testdata", "content"),
Host: "0.0.0.0", Host: "0.0.0.0",
ThemeDir: "testdata/theme/", ThemeDir: filepath.Join("testdata", "theme"),
StaticDir: "testdata/static/", StaticDir: filepath.Join("testdata", "static"),
Port: 3000, Port: 3000,
} }
} }

View File

@ -24,7 +24,7 @@ func NewFile(path string) File {
Language: LanguageUnd, Language: LanguageUnd,
baseFileName: "", baseFileName: "",
contentBaseName: "", contentBaseName: "",
dir: filepath.Dir(path) + "/", dir: filepath.Dir(path) + string(filepath.Separator),
ext: strings.TrimPrefix(filepath.Ext(path), "."), ext: strings.TrimPrefix(filepath.Ext(path), "."),
filename: path, filename: path,
logicalName: filepath.Base(path), logicalName: filepath.Base(path),