mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-12 23:05:15 +00:00
fix: add validation that PUBLIC_APP_URL can't contain a path
This commit is contained in:
@@ -2,6 +2,7 @@ package common
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/caarlos0/env/v11"
|
"github.com/caarlos0/env/v11"
|
||||||
_ "github.com/joho/godotenv/autoload"
|
_ "github.com/joho/godotenv/autoload"
|
||||||
@@ -61,4 +62,12 @@ func init() {
|
|||||||
if EnvConfig.DbProvider == DbProviderSqlite && EnvConfig.SqliteDBPath == "" {
|
if EnvConfig.DbProvider == DbProviderSqlite && EnvConfig.SqliteDBPath == "" {
|
||||||
log.Fatal("Missing SQLITE_DB_PATH environment variable")
|
log.Fatal("Missing SQLITE_DB_PATH environment variable")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parsedAppUrl, err := url.Parse(EnvConfig.AppURL)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("PUBLIC_APP_URL is not a valid URL")
|
||||||
|
}
|
||||||
|
if parsedAppUrl.Path != "" {
|
||||||
|
log.Fatal("PUBLIC_APP_URL must not contain a path")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user