~edwargix/git.sr.ht

1b4423e12c21dd2de7454205ac09f2e5a440a4a5 — Thorben Günther 6 years ago bfe62f1
Allow users to set redis port too.
3 files changed, 3 insertions(+), 6 deletions(-)

M gitsrht-keys/main.go
M gitsrht-update-hook/post-update.go
M gitsrht-update-hook/update.go
M gitsrht-keys/main.go => gitsrht-keys/main.go +1 -2
@@ 150,9 150,8 @@ func main() {

	redisHost, ok := config.Get("sr.ht", "redis-host")
	if !ok {
		redisHost = "localhost"
		redisHost = "localhost:6379"
	}
	redisHost += ":6379"
	redis := goredis.NewClient(&goredis.Options{Addr: redisHost})

	logf, err := os.OpenFile("/var/log/gitsrht-keys",

M gitsrht-update-hook/post-update.go => gitsrht-update-hook/post-update.go +1 -2
@@ 162,9 162,8 @@ func postUpdate() {

	redisHost, ok := config.Get("sr.ht", "redis-host")
	if !ok {
		redisHost = "localhost"
		redisHost = "localhost:6379"
	}
	redisHost += ":6379"
	redis := goredis.NewClient(&goredis.Options{Addr: redisHost})
	for i, refname := range refs {
		var oldref, newref string

M gitsrht-update-hook/update.go => gitsrht-update-hook/update.go +1 -2
@@ 24,9 24,8 @@ func update() {

	redisHost, ok := config.Get("sr.ht", "redis-host")
	if !ok {
		redisHost = "localhost"
		redisHost = "localhost:6379"
	}
	redisHost += ":6379"
	redis := goredis.NewClient(&goredis.Options{Addr: redisHost})
	redis.Set(fmt.Sprintf("update.%s.%s", pushUuid, refname),
		fmt.Sprintf("%s:%s", oldref, newref), 10*time.Minute)