Add support for serving local files on 'listen' mode
Some checks failed
/ basic (push) Failing after 22s
Some checks failed
/ basic (push) Failing after 22s
This commit is contained in:
parent
585b4408f3
commit
7627a5bc1c
1 changed files with 11 additions and 3 deletions
|
|
@ -41,6 +41,8 @@ is up to you, eg. Nginx, Apache, or even a simple Go server.
|
||||||
token := viper.GetString("token")
|
token := viper.GetString("token")
|
||||||
dir := viper.GetString("dir")
|
dir := viper.GetString("dir")
|
||||||
branch := viper.GetString("branch")
|
branch := viper.GetString("branch")
|
||||||
|
notFound := viper.GetString("notfound")
|
||||||
|
files := viper.GetString("files")
|
||||||
if bind == "" || server == "" || user == "" || token == "" || branch == "" || dir == "" {
|
if bind == "" || server == "" || user == "" || token == "" || branch == "" || dir == "" {
|
||||||
fmt.Println("bind, server, user, token, branch and dir are required")
|
fmt.Println("bind, server, user, token, branch and dir are required")
|
||||||
fmt.Println("dumping flags:")
|
fmt.Println("dumping flags:")
|
||||||
|
|
@ -50,6 +52,8 @@ is up to you, eg. Nginx, Apache, or even a simple Go server.
|
||||||
fmt.Println(" token: ", token)
|
fmt.Println(" token: ", token)
|
||||||
fmt.Println(" branch: ", branch)
|
fmt.Println(" branch: ", branch)
|
||||||
fmt.Println(" dir: ", dir)
|
fmt.Println(" dir: ", dir)
|
||||||
|
fmt.Println(" notfound: ", notFound)
|
||||||
|
fmt.Println(" files: ", files)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
serverUrl, err := url.Parse(server)
|
serverUrl, err := url.Parse(server)
|
||||||
|
|
@ -63,6 +67,8 @@ is up to you, eg. Nginx, Apache, or even a simple Go server.
|
||||||
Server: *serverUrl,
|
Server: *serverUrl,
|
||||||
Token: token,
|
Token: token,
|
||||||
Branch: branch,
|
Branch: branch,
|
||||||
|
NotFound: notFound,
|
||||||
|
Files: files,
|
||||||
},
|
},
|
||||||
GitDir: filepath.Join(dir, "git"),
|
GitDir: filepath.Join(dir, "git"),
|
||||||
PageDir: filepath.Join(dir, "pages"),
|
PageDir: filepath.Join(dir, "pages"),
|
||||||
|
|
@ -103,4 +109,6 @@ func init() {
|
||||||
f.StringP("token", "k", "", "Forgejo api token or password")
|
f.StringP("token", "k", "", "Forgejo api token or password")
|
||||||
f.StringP("branch", "b", "static-pages", "branch to use")
|
f.StringP("branch", "b", "static-pages", "branch to use")
|
||||||
f.StringP("dir", "d", "", "directory to store data, must be writable")
|
f.StringP("dir", "d", "", "directory to store data, must be writable")
|
||||||
|
f.StringP("notfound", "n", "", "path to custom 404.html file")
|
||||||
|
f.StringP("files", "f", "", "path for files to be served ")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue