Skip to content

Commit d55360e

Browse files
committed
feat(app): print accessible urls with prefix
1 parent 6e6bcd0 commit d55360e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/app/accessibleUrls.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@ package app
22

33
import (
44
"mjpclab.dev/ghfs/src/goVirtualHost"
5+
"mjpclab.dev/ghfs/src/param"
56
"mjpclab.dev/ghfs/src/util"
67
"strconv"
78
)
89

9-
func printAccessibleURLs(vhSvc *goVirtualHost.Service) {
10+
func printAccessibleURLs(vhSvc *goVirtualHost.Service, params param.Params) {
1011
vhostsUrls := vhSvc.GetAccessibleURLs(false)
1112
file, teardown := util.GetTTYFile()
1213

1314
for vhIndex := range vhostsUrls {
15+
prefix := ""
16+
if len(params[vhIndex].PrefixUrls) > 0 {
17+
prefix = params[vhIndex].PrefixUrls[0]
18+
}
19+
1420
file.WriteString("Host " + strconv.Itoa(vhIndex) + " may be accessed by URLs:\n")
1521
for urlIndex := range vhostsUrls[vhIndex] {
16-
file.WriteString(" " + vhostsUrls[vhIndex][urlIndex] + "\n")
22+
file.WriteString(" " + vhostsUrls[vhIndex][urlIndex] + prefix + "/\n")
1723
}
1824
}
1925

src/app/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func NewApp(params param.Params, setting *setting.Setting) (*App, []error) {
118118
}
119119

120120
if !setting.Quiet {
121-
go printAccessibleURLs(vhSvc)
121+
go printAccessibleURLs(vhSvc, params)
122122
}
123123

124124
return &App{

0 commit comments

Comments
 (0)