some changes to stuff

Signed-off-by: Odyssey346 <odyssey346@disroot.org>
This commit is contained in:
Odyssey346 2022-07-31 22:49:08 +02:00
parent 11a156e4e3
commit 7c1c80e0a9
3 changed files with 12 additions and 7 deletions

3
docker.env Normal file
View File

@ -0,0 +1,3 @@
HCAPTCHA_SITE_KEY='YOURSITEKEY'
HCAPTCHA_SECRET_KEY='YOURSECRETKEY'
SEGFAUTILITIES_WEBHOOK_URL='YOURWEBHOOKURL'

View File

@ -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!")

View File

@ -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.