-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
153 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,18 +42,21 @@ func main() { | |
|
||
// application | ||
app := cli.NewApp() | ||
cli.VersionFlag = &cli.BoolFlag{Name: "version", Aliases: []string{"V"}} | ||
cli.VersionFlag = &cli.BoolFlag{ | ||
Name: "version", | ||
Usage: "show version", | ||
Aliases: []string{"V"}, | ||
DisableDefaultText: true, | ||
} | ||
|
||
app.Name = "alice" | ||
app.Version = fmt.Sprintf("%s\t%s", version, buildtime) | ||
app.Authors = []*cli.Author{ | ||
&cli.Author{ | ||
Name: "MindHunter86", | ||
Email: "[email protected]", | ||
}, | ||
} | ||
app.Copyright = "(c) 2024 mindhunter86\nwith love for AniLibria project" | ||
app.Usage = "AniLibria legacy api cache service" | ||
app.Authors = append(app.Authors, &cli.Author{ | ||
Name: "MindHunter86", | ||
Email: "[email protected]", | ||
}) | ||
|
||
app.Flags = []cli.Flag{ | ||
// common settings | ||
|
@@ -65,59 +68,78 @@ func main() { | |
EnvVars: []string{"LOG_LEVEL"}, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "quite", | ||
Aliases: []string{"q"}, | ||
Usage: "Flag is equivalent to --log-level=quite", | ||
Name: "quite", | ||
Aliases: []string{"q"}, | ||
Usage: "equivalent to --log-level=quite", | ||
DisableDefaultText: true, | ||
}, | ||
|
||
// common settings : syslog | ||
&cli.StringFlag{ | ||
Name: "syslog-server", | ||
Usage: "syslog server (optional); syslog sender is not used if value is empty", | ||
Value: "", | ||
EnvVars: []string{"SYSLOG_ADDRESS"}, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "syslog-proto", | ||
Usage: "syslog protocol (optional); tcp or udp is possible", | ||
Value: "tcp", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "syslog-tag", | ||
Usage: "optional setting; more information in syslog RFC", | ||
Value: "", | ||
}, | ||
|
||
// fiber-server settings | ||
&cli.StringFlag{ | ||
Name: "http-listen-addr", | ||
Usage: "Ex: 127.0.0.1:8080, :8080", | ||
Usage: "format - 127.0.0.1:8080, :8080", | ||
Value: "127.0.0.1:8080", | ||
}, | ||
&cli.StringFlag{ | ||
Name: "http-trusted-proxies", | ||
Usage: "Ex: 10.0.0.0/8; Separated by comma", | ||
Usage: "format - 192.168.0.0/16; can be separated by comma", | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "http-prefork", | ||
Usage: `Enables use of the SO_REUSEPORT socket option; | ||
Usage: `enables use of the SO_REUSEPORT socket option; | ||
if enabled, the application will need to be ran | ||
through a shell because prefork mode sets environment variables`, | ||
through a shell because prefork mode sets environment variables; | ||
EXPERIMENTAL! USE CAREFULLY!`, | ||
DisableDefaultText: true, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "http-pprof-enable", | ||
Usage: "enable golang http-pprof methods", | ||
Name: "http-pprof-enable", | ||
Usage: "enable golang http-pprof methods", | ||
DisableDefaultText: true, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "http-access-logs-level", | ||
Usage: "set logger level for access-log logs", | ||
Value: zerolog.LevelDebugValue, | ||
}, | ||
|
||
// limiter settings | ||
&cli.BoolFlag{ | ||
Name: "limiter-use-bbolt", | ||
Usage: "use bbolt key\value file database instead of memory database", | ||
}, | ||
&cli.IntFlag{ | ||
Name: "limiter-max-req", | ||
Value: 200, | ||
}, | ||
&cli.DurationFlag{ | ||
Name: "limiter-records-duration", | ||
Value: 5 * time.Minute, | ||
// &cli.BoolFlag{ | ||
// Name: "limiter-use-bbolt", | ||
// Usage: "use bbolt key\value file database instead of memory database", | ||
// }, | ||
// &cli.IntFlag{ | ||
// Name: "limiter-max-req", | ||
// Value: 200, | ||
// }, | ||
// &cli.DurationFlag{ | ||
// Name: "limiter-records-duration", | ||
// Value: 5 * time.Minute, | ||
// }, | ||
|
||
// rewriter settings | ||
&cli.StringFlag{ | ||
Name: "rewriter-response-header", | ||
Usage: "header for parsed payload", | ||
Value: "X-Parsed-Form", | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.