repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
8f87763
parent
b9ae93d
author
Antonio Mika
date
2024-10-03 22:39:30 +0000 UTC
Add configuration options
3 files changed,  +25, -9
M docker-compose.prod.yml
+10, -0
 1@@ -74,6 +74,8 @@ services:
 2           - web
 3     env_file:
 4       - .env.prod
 5+    volumes:
 6+      - ./data/pastes-ssh/data:/app/ssh_data
 7   pastes-ssh:
 8     networks:
 9       pastes:
10@@ -116,6 +118,8 @@ services:
11           - web
12     env_file:
13       - .env.prod
14+    volumes:
15+      - ./data/pubsub-ssh/data:/app/ssh_data
16   pubsub-ssh:
17     networks:
18       pubsub:
19@@ -158,6 +162,8 @@ services:
20           - web
21     env_file:
22       - .env.prod
23+    volumes:
24+      - ./data/prose-ssh/data:/app/ssh_data
25   prose-ssh:
26     networks:
27       prose:
28@@ -202,6 +208,7 @@ services:
29       - .env.prod
30     volumes:
31       - ./data/storage/data:/app/.storage
32+      - ./data/imgs-ssh/data:/app/ssh_data
33   imgs-ssh:
34     networks:
35       imgs:
36@@ -248,6 +255,7 @@ services:
37       - .env.prod
38     volumes:
39       - ./data/storage/data:/app/.storage
40+      - ./data/pgs-ssh/data:/app/ssh_data
41   pgs-ssh:
42     networks:
43       pgs:
44@@ -296,6 +304,8 @@ services:
45           - web
46     env_file:
47       - .env.prod
48+    volumes:
49+      - ./data/feeds-ssh/data:/app/ssh_data
50   feeds-ssh:
51     networks:
52       feeds:
M shared/config.go
+10, -4
 1@@ -272,12 +272,18 @@ func CreateLogger(space string) *slog.Logger {
 2 		slog.NewTextHandler(os.Stdout, opts),
 3 	)
 4 
 5-	newLog, err := SendLogRegister(log, 100)
 6-	if err != nil {
 7-		slog.Error("unable to start send logger", "error", err)
 8+	newLogger := log
 9+
10+	if strings.ToLower(GetEnv("PICO_SENDLOG_ENABLED", "true")) == "true" {
11+		newLog, err := SendLogRegister(log, 100)
12+		if err == nil {
13+			newLogger = newLog
14+		} else {
15+			slog.Error("unable to start send logger", "error", err)
16+		}
17 	}
18 
19-	return newLog.With("service", space)
20+	return newLogger.With("service", space)
21 }
22 
23 func LoggerWithUser(logger *slog.Logger, user *db.User) *slog.Logger {
M shared/sendlog.go
+5, -5
 1@@ -139,11 +139,11 @@ func (c *SendLogWriter) Open() error {
 2 	c.Messages = make(chan []byte, c.BufferSize)
 3 
 4 	sshClient, err := createSSHClient(
 5-		"send.pico.sh:22",
 6-		"ssh_data/term_info_ed25519",
 7-		"",
 8-		"send.pico.sh",
 9-		"pico",
10+		GetEnv("PICO_SENDLOG_ENDPOINT", "send.pico.sh:22"),
11+		GetEnv("PICO_SENDLOG_KEY", "ssh_data/term_info_ed25519"),
12+		GetEnv("PICO_SENDLOG_PASSPHRASE", ""),
13+		GetEnv("PICO_SENDLOG_REMOTE_HOST", "send.pico.sh"),
14+		GetEnv("PICO_SENDLOG_USER", "pico"),
15 	)
16 	if err != nil {
17 		c.connecMu.Unlock()