mirror of
https://github.com/layer-systems/relay.git
synced 2026-06-04 01:21:22 +02:00
add QUERY_LIMIT environment variable and integrate into database initialization (#2)
Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
@@ -13,6 +13,7 @@ services:
|
||||
- RELAY_PUBKEY=480ec1a7516406090dc042ddf67780ef30f26f3a864e83b417c053a5a611c838
|
||||
- RELAY_DESCRIPTION=this is a public relay
|
||||
- RELAY_ICON=https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fliquipedia.net%2Fcommons%2Fimages%2F3%2F35%2FSCProbe.jpg&f=1&nofb=1&ipt=0cbbfef25bce41da63d910e86c3c343e6c3b9d63194ca9755351bb7c2efa3359&ipo=images
|
||||
- QUERY_LIMIT=1000
|
||||
db:
|
||||
image: postgres:17
|
||||
restart: always
|
||||
|
||||
4
main.go
4
main.go
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/fiatjaf/eventstore/postgresql"
|
||||
@@ -61,7 +62,8 @@ func main() {
|
||||
relay.Info.Description = getEnv("RELAY_DESCRIPTION", "this is a public relay")
|
||||
relay.Info.Icon = getEnv("RELAY_ICON", "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fliquipedia.net%2Fcommons%2Fimages%2F3%2F35%2FSCProbe.jpg&f=1&nofb=1&ipt=0cbbfef25bce41da63d910e86c3c343e6c3b9d63194ca9755351bb7c2efa3359&ipo=images")
|
||||
|
||||
db := postgresql.PostgresBackend{DatabaseURL: getEnv("DATABASE_URL", "postgresql://postgres:postgres@db:5432/khatru-relay?sslmode=disable")}
|
||||
queryLimit, _ := strconv.Atoi(getEnv("QUERY_LIMIT", "100"))
|
||||
db := postgresql.PostgresBackend{DatabaseURL: getEnv("DATABASE_URL", "postgresql://postgres:postgres@db:5432/khatru-relay?sslmode=disable"), QueryLimit: queryLimit}
|
||||
if err := db.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user