diff --git a/docker.env b/docker.env new file mode 100644 index 0000000..55e14f4 --- /dev/null +++ b/docker.env @@ -0,0 +1,3 @@ +HCAPTCHA_SITE_KEY='YOURSITEKEY' +HCAPTCHA_SECRET_KEY='YOURSECRETKEY' +SEGFAUTILITIES_WEBHOOK_URL='YOURWEBHOOKURL' \ No newline at end of file diff --git a/otherthings/checkenv.go b/otherthings/checkenv.go index 4130249..787aecd 100644 --- a/otherthings/checkenv.go +++ b/otherthings/checkenv.go @@ -19,19 +19,19 @@ func CheckEnv() { log.Fatal("[Segfautilities] Environment variable SEGFAUTILITIES_PORT is not set! Please set it to a number, for example 6893") } unused, ok1 = os.LookupEnv("HCAPTCHA_SITE_KEY") - if !ok1 { + if !ok1 || unused == "YOURSITEKEY" { log.Fatal("[Segfautilities] Environment variable HCAPTCHA_SITE_KEY is not set! Please set it to the site key you got from hCaptcha.") } else { log.Println("[Segfautilities] Environment variable HCAPTCHA_SITE_KEY is set as " + unused) } unused, ok1 = os.LookupEnv("HCAPTCHA_SECRET_KEY") - if !ok1 { + if !ok1 || unused == "YOURSECRETKEY" { log.Fatal("[Segfautilities] Environment variable HCAPTCHA_SECRET_KEY is not set! Please set it to the secret key you got from hCaptcha.") } else { log.Println("[Segfautilities] Environment variable HCAPTCHA_SECRET_KEY is set!") } unused, ok1 = os.LookupEnv("SEGFAUTILITIES_WEBHOOK_URL") - if !ok1 { + if !ok1 || unused == "YOURWEBHOOKURL" { log.Fatal("[Segfautilities] Environment variable SEGFAUTILITIES_WEBHOOK_URL is not set! Please set it to your webhook URL. If that URL doesn't work, make an issue on GitHub!") } else { log.Println("[Segfautilities] Environment variable SEGFAUTILITIES_WEBHOOK_URL is set!") diff --git a/readme.md b/readme.md index 6b7d561..9f554ce 100644 --- a/readme.md +++ b/readme.md @@ -6,10 +6,12 @@ For now it powers our contact form. In the future we will expand our APIs so you ## Setup -### Docker: +### Docker: ``` -docker run -d --restart=always -p 6893:6893 --name segfautilities projectsegfault/segfautilities:latest -e HCAPTCHA_SITE_KEY='YOURSITEKEY' -e HCAPTCHA_SECRET_KEY='YOURSECRETKEY' -e SEGFAUTILITIES_WEBHOOK_URL='YOURWEBHOOKURL' +docker run -d --restart=always -p 6893:6893 --name segfautilities projectsegfault/segfautilities:latest --env-file ./docker.env ``` +docker.env should be the environment file located in this repository, customized to your settings. The env file is self-documenting so I don't need to go in any detail here. + We recommend using Docker as it provides better security (we suck in security, so that's why) and we are constantly updating Segfautilities. Docker makes it easy to update the program. @@ -23,9 +25,9 @@ cd segfautilities/ go run main.go # Run this when you've done above! ``` #### NixOS -``` +``` git clone https://github.com/ProjectSegfault/segfautilities -cd segfautilities/ +cd segfautilities/ nix-shell # Avoid installing Go and setting up the web port, by just running a nix shell # You still need the environment variables HCAPTCHA_SITE_KEY, HCAPTCHA_SECRET_KEY and SEGFAUTILITIES_WEBHOOK_URL though! go run main.go # I wonder if this is good practice or not. If this isn't good practice, make a GitHub issue please.