From 00c63a19a19f848eea0b9741383889419c34fe37 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 14 Dec 2023 18:11:11 +0200 Subject: [PATCH 1/3] add flag to customize database path --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0131208..9fd15ba 100644 --- a/main.go +++ b/main.go @@ -41,6 +41,7 @@ var ( flagSessionSecret string = util.RandomString(32) flagWgConfTemplate string flagBasePath string + flagDBPath string = "./db" ) const ( @@ -80,6 +81,7 @@ func init() { flag.StringVar(&flagSessionSecret, "session-secret", util.LookupEnvOrString("SESSION_SECRET", flagSessionSecret), "The key used to encrypt session cookies.") flag.StringVar(&flagWgConfTemplate, "wg-conf-template", util.LookupEnvOrString("WG_CONF_TEMPLATE", flagWgConfTemplate), "Path to custom wg.conf template.") flag.StringVar(&flagBasePath, "base-path", util.LookupEnvOrString("BASE_PATH", flagBasePath), "The base path of the URL") + flag.StringVar(&flagDBPath, "database-path", util.LookupEnvOrString("WG_DATABASE_PATH", flagDBPath), "The custom path to database.") flag.Parse() // update runtime config @@ -120,7 +122,7 @@ func init() { } func main() { - db, err := jsondb.New("./db") + db, err := jsondb.New(flagDBPath) if err != nil { panic(err) } From 929da0badafe29ca9e6c3b1479ce8e1ecfcd95e6 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 14 Dec 2023 18:54:40 +0200 Subject: [PATCH 2/3] changed default path for database --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 9fd15ba..f69d0e6 100644 --- a/main.go +++ b/main.go @@ -41,7 +41,7 @@ var ( flagSessionSecret string = util.RandomString(32) flagWgConfTemplate string flagBasePath string - flagDBPath string = "./db" + flagDBPath string = "/etc/wireguard/db" ) const ( From c36a69a78de72be61128200406671f428b6d65fd Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 14 Dec 2023 23:12:08 +0200 Subject: [PATCH 3/3] described variable in README file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0da4652..316eebd 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ docker-compose up | `SMTP_PASSWORD` | The SMTP user password | N/A | | `SMTP_AUTH_TYPE` | The SMTP authentication type. Possible values: `PLAIN`, `LOGIN`, `NONE` | `NONE` | | `SMTP_ENCRYPTION` | the encryption method. Possible values: `NONE`, `SSL`, `SSLTLS`, `TLS`, `STARTTLS` | `STARTTLS` | - +| `WG_DATABASE_PATH` | The path to database where stores all WG data | `/etc/wireguard/db` | ### Defaults for server configuration These environment variables are used to control the default server settings used when initializing the database.