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")
|
||||
dir := viper.GetString("dir")
|
||||
branch := viper.GetString("branch")
|
||||
notFound := viper.GetString("notfound")
|
||||
files := viper.GetString("files")
|
||||
if bind == "" || server == "" || user == "" || token == "" || branch == "" || dir == "" {
|
||||
fmt.Println("bind, server, user, token, branch and dir are required")
|
||||
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(" branch: ", branch)
|
||||
fmt.Println(" dir: ", dir)
|
||||
fmt.Println(" notfound: ", notFound)
|
||||
fmt.Println(" files: ", files)
|
||||
return
|
||||
}
|
||||
serverUrl, err := url.Parse(server)
|
||||
|
|
@ -60,9 +64,11 @@ is up to you, eg. Nginx, Apache, or even a simple Go server.
|
|||
|
||||
cfg := &lib.WebhookCFG{
|
||||
Forgejo: lib.Forgejo{
|
||||
Server: *serverUrl,
|
||||
Token: token,
|
||||
Branch: branch,
|
||||
Server: *serverUrl,
|
||||
Token: token,
|
||||
Branch: branch,
|
||||
NotFound: notFound,
|
||||
Files: files,
|
||||
},
|
||||
GitDir: filepath.Join(dir, "git"),
|
||||
PageDir: filepath.Join(dir, "pages"),
|
||||
|
|
@ -103,4 +109,6 @@ func init() {
|
|||
f.StringP("token", "k", "", "Forgejo api token or password")
|
||||
f.StringP("branch", "b", "static-pages", "branch to use")
|
||||
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