♻️ 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 (
"net"
"net/netip"
"path/filepath"
"strconv"
"testing"
)
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"`
ThemeDir string `env:"THEME_DIR" envDefault:"theme/"`
StaticDir string `env:"STATIC_DIR" envDefault:"static/"`
ThemeDir string `env:"THEME_DIR" envDefault:"theme"`
StaticDir string `env:"STATIC_DIR" envDefault:"static"`
Port uint16 `env:"PORT" envDefault:"3000"`
}
@ -19,10 +20,10 @@ func TestConfig(tb testing.TB) *Config {
tb.Helper()
return &Config{
ContentDir: "testdata/content/",
ContentDir: filepath.Join("testdata", "content"),
Host: "0.0.0.0",
ThemeDir: "testdata/theme/",
StaticDir: "testdata/static/",
ThemeDir: filepath.Join("testdata", "theme"),
StaticDir: filepath.Join("testdata", "static"),
Port: 3000,
}
}

View File

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