1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 22:39:18 +01:00

feat(dev): moves vite integeration to backend (#2272)

* feat(dev): moves vite integeration to backend

* fixes dockerbuild

* fixes docker build

* fixes custom base

* fixes base path again

* uses concurrently instead

* fixes go tests
This commit is contained in:
Amir Raminfar
2023-06-27 09:20:24 -07:00
committed by GitHub
parent 263029d77e
commit 05a4b7c25a
8 changed files with 157 additions and 404 deletions

20
main.go
View File

@@ -162,6 +162,7 @@ func createClients(args args, localClientFactory func(map[string][]string) (dock
}
func createServer(args args, clients map[string]docker.Client) *http.Server {
_, dev := os.LookupEnv("DEV")
config := web.Config{
Addr: args.Addr,
Base: args.Base,
@@ -170,6 +171,7 @@ func createServer(args args, clients map[string]docker.Client) *http.Server {
Password: args.Password,
Hostname: args.Hostname,
NoAnalytics: args.NoAnalytics,
Dev: dev,
}
assets, err := fs.Sub(content, "dist")
@@ -178,8 +180,22 @@ func createServer(args args, clients map[string]docker.Client) *http.Server {
}
if _, ok := os.LookupEnv("LIVE_FS"); ok {
log.Info("Using live filesystem at ./dist")
assets = os.DirFS("./dist")
if dev {
log.Info("Using live filesystem at ./public")
assets = os.DirFS("./public")
} else {
log.Info("Using live filesystem at ./dist")
assets = os.DirFS("./dist")
}
}
if !dev {
if _, err := assets.Open("manifest.json"); err != nil {
log.Fatal("manifest.json not found")
}
if _, err := assets.Open("index.html"); err != nil {
log.Fatal("index.html not found")
}
}
return web.CreateServer(clients, assets, config)