Allow different port

This commit is contained in:
2025-08-06 12:46:00 +02:00
parent 7de6aab73d
commit 64b594c4ac
2 changed files with 12 additions and 11 deletions

View File

@@ -13,11 +13,13 @@ import (
func watchAction(ctx *cli.Context) error {
cfgPath, err := filepath.Abs(ctx.String("c"))
if err != nil {
return err
}
lrport := ctx.Uint("lr-port")
fmt.Printf("Live reload is running on port %d\n", lrport)
os.Chdir(filepath.Dir(cfgPath))
optsSetups := readCfg(cfgPath)
@@ -25,7 +27,7 @@ func watchAction(ctx *cli.Context) error {
purge(opts)
cp(opts)
build(opts)
injectLR(opts)
injectLR(lrport, opts)
replace(opts)
}
@@ -106,8 +108,7 @@ func watchAction(ctx *cli.Context) error {
go func() {
fmt.Println("Starting live reload server.")
port := ctx.Uint("lr-port")
lr := lrserver.New(lrserver.DefaultName, uint16(port))
lr := lrserver.New(lrserver.DefaultName, uint16(lrport))
go func() {
for {