update logo

This commit is contained in:
dpurbosakti
2025-12-17 15:11:32 +07:00
parent 28bc7f9838
commit 918bbaa315
3 changed files with 57 additions and 2 deletions
+48
View File
@@ -0,0 +1,48 @@
package assets
import (
"log"
"os"
"path/filepath"
)
func exeDir() string {
exe, err := os.Executable()
if err != nil {
panic(err)
}
return filepath.Dir(exe)
}
func GetAssetsDir() string {
exe, err := os.Executable()
if err != nil {
log.Println(
"[ASSETS][ERROR] Failed to resolve executable path.",
"This should never happen in a built binary.",
"Error:", err,
)
return ""
}
exeDir := filepath.Dir(exe)
assets := filepath.Join(exeDir, "assets")
if _, err := os.Stat(assets); err != nil {
log.Println(
"[ASSETS][ERROR] Assets directory not found next to binary.",
"This error ONLY occurs when the application is running from a built binary.",
"Expected path:", assets,
"Executable path:", exe,
)
return ""
}
log.Println(
"[ASSETS][OK] Static assets enabled.",
"Mode: production (binary execution).",
"Assets path:", assets,
)
return assets
}
@@ -65,6 +65,7 @@ import (
hk "github.com/karincake/hongkue"
/******************** infra ********************/
assets "simrs-vx/internal/infra/assets"
ibpjs "simrs-vx/internal/infra/bpjs"
docscfg "simrs-vx/internal/infra/docs-cfg"
gs "simrs-vx/internal/infra/gorm-setting"
@@ -161,6 +162,12 @@ func SetRoutes() http.Handler {
r := http.NewServeMux()
r.Handle("/assets/",
http.StripPrefix("/assets/",
http.FileServer(http.Dir(assets.GetAssetsDir())),
),
)
/******************** Main ********************/
r.HandleFunc("/", home.Home)