Add support for serving local files on 'listen' mode
Some checks failed
/ basic (push) Failing after 22s

This commit is contained in:
天クマ 2026-05-16 12:29:31 -03:00
commit 7627a5bc1c

View file

@ -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 ")
}