tangled
alpha
login
or
join now
willdot.net
/
feed-demo-go
4
fork
atom
A demo of a Bluesky feed generator in Go
4
fork
atom
overview
issues
pulls
pipelines
forgot that the port must be 443
willdot.net
6 months ago
6e9fcde6
b903c24a
+2
-20
2 changed files
expand all
collapse all
unified
split
.env-example
main.go
-1
.env-example
···
1
1
FEED_DID_BASE="test"
2
2
FEED_HOST_NAME="test"
3
3
FEED_NAME="test-feed"
4
4
-
SERVER_PORT="3000"
+2
-19
main.go
···
9
9
"os"
10
10
"os/signal"
11
11
"path"
12
12
-
"strconv"
13
12
"syscall"
14
13
15
14
"github.com/avast/retry-go/v4"
···
18
17
19
18
const (
20
19
defaultJetstreamAddr = "wss://jetstream.atproto.tools/subscribe"
21
21
-
defaultServerPort = 3000
20
20
+
serverPort = 443 // this must be the port value used. See https://docs.bsky.app/docs/starter-templates/custom-feeds#deploying-your-feed
22
21
)
23
22
24
23
func main() {
···
49
48
if feedHost == "" {
50
49
return fmt.Errorf("FEED_NAME not set")
51
50
}
52
52
-
serverPort, err := getServerPort()
53
53
-
if err != nil {
54
54
-
return err
55
55
-
}
51
51
+
56
52
dbPath := os.Getenv("DATABASE_PATH")
57
53
if dbPath == "" {
58
54
dbPath = "./"
···
113
109
114
110
slog.Warn("exiting consume loop")
115
111
}
116
116
-
117
117
-
func getServerPort() (int, error) {
118
118
-
portStr := os.Getenv("SERVER_PORT")
119
119
-
if portStr == "" {
120
120
-
return defaultServerPort, nil
121
121
-
}
122
122
-
123
123
-
port, err := strconv.Atoi(portStr)
124
124
-
if err != nil {
125
125
-
return 0, fmt.Errorf("invalid port specified: %w", err)
126
126
-
}
127
127
-
return port, nil
128
128
-
}