Merge pull request #222 from dikstub-rssa/fix/anything-moko

update logo
This commit is contained in:
Dwi Atmoko Purbo Sakti
2025-12-17 15:12:10 +07:00
committed by GitHub
3 changed files with 57 additions and 2 deletions
+2 -2
View File
@@ -48,7 +48,7 @@
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="text-align: center">
<img src="assets/docs/logo-provinsi-jawa-timur.png" alt="logo" style="height: 70px" />
<img src="/assets/docs/logo-provinsi-jawa-timur.png" alt="logo" style="height: 70px" />
</td>
<td style="text-align: center">
<div style="font-size: 14px; font-weight: bold">
@@ -68,7 +68,7 @@
<div>Website: www.rsudsaifulanwar.jatimprov.go.id</div>
</td>
<td style="text-align: center">
<img src="assets/docs/logo-rssa.png" alt="logo" style="height: 70px" />
<img src="/assets/docs/logo-rssa.png" alt="logo" style="height: 70px" />
</td>
</tr>
</table>
+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)