feat: add cli parameters for db path and metrics port (#4)

Add support for configuring CLI parameters in the application using a new
`cfg` package. The `cfg` package exports an `AppSettings` struct that
contains the settings the application was run with.
Update the application to use the new CLI parameters to set the db to open
and the port to use for the metrics server.
Add support for setting the app version during build. The app includes a
`-version` flag to print the stored version data.
This commit is contained in:
Hector
2021-02-06 15:17:35 +00:00
parent 5e81a98162
commit 4f18bf35a8
3 changed files with 83 additions and 16 deletions

View File

@ -10,7 +10,7 @@ const queryBannedIpsPerJail = "SELECT j.name, (SELECT COUNT(1) FROM bans b WHERE
type Fail2BanDB struct {
DatabasePath string
sqliteDB *sql.DB
sqliteDB *sql.DB
}
func MustConnectToDb(databasePath string) *Fail2BanDB {