moved hardcoded /style path to -style option
parent
67edb01b9c
commit
452cc23208
|
@ -63,6 +63,7 @@ var host_opt *string = flag.String("host", "http://127.0.0.1:8080", "Node addres
|
|||
var verbose_opt *bool = flag.Bool("v", false, "Verbose")
|
||||
var echo_opt *string = flag.String("e", "list.txt", "Echoes list")
|
||||
var tpl_path_opt *string = flag.String("tpl", "./tpl", "Path to html templates")
|
||||
var style_path_opt *string = flag.String("style", "./style", "Path to /style web-directory (css/images)")
|
||||
|
||||
type WWW struct {
|
||||
Host string
|
||||
|
@ -108,7 +109,13 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
if _, err := os.Stat(*style_path_opt); errors.Is(err, os.ErrNotExist) {
|
||||
ii.Info.Printf("Web share dir %s (for css/images) not found",
|
||||
*style_path_opt)
|
||||
}
|
||||
|
||||
unix.Unveil(*tpl_path_opt, "r")
|
||||
unix.Unveil(*style_path_opt, "r")
|
||||
unix.Unveil(*echo_opt, "r")
|
||||
unix.Unveil(*users_opt, "rwc")
|
||||
unix.Unveil(filepath.Dir(*db_opt), "rwc")
|
||||
|
@ -131,7 +138,7 @@ func main() {
|
|||
www.Host = *host_opt
|
||||
WebInit(&www)
|
||||
|
||||
fs := http.FileServer(http.Dir("style"))
|
||||
fs := http.FileServer(http.Dir(*style_path_opt))
|
||||
http.Handle("/style/", http.StripPrefix("/style/", fs))
|
||||
|
||||
http.HandleFunc("/list.txt", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in New Issue