alpha
Login
or
Join now
vvill.dev
/
caddy-atproto-auth
Star
3
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Caddy module to require at-proto authentication and restrict routes to DIDs
Star
3
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Fix db pathing issue
author
Will Garrison
date
3 months ago
(Mar 24, 2026, 9:21 PM -0700)
commit
a1c1084d
a1c1084dc37eaf8c98e25c0bd55f0dbee5a76c12
parent
58ff42fd
58ff42fde066c9d610480e012d3292ebcac3a421
+10
-1
2 changed files
Expand all
Collapse all
Unified
Split
global.go
internal
db
db.go
+2
-1
global.go
Reviewed
···
2
2
3
3
import (
4
4
"fmt"
5
5
+
"path/filepath"
5
6
"strconv"
6
7
"time"
7
8
···
42
43
func (a *App) Provision(ctx caddy.Context) error {
43
44
// Defaults
44
45
if a.StoragePath == "" {
45
45
-
a.StoragePath = "atproto.db"
46
46
+
a.StoragePath = filepath.Join(caddy.AppDataDir(), "atproto.db")
46
47
}
47
48
48
49
// Initialize DB
+8
internal/db/db.go
Reviewed
···
7
7
"encoding/hex"
8
8
"encoding/json"
9
9
"fmt"
10
10
+
"os"
11
11
+
"path/filepath"
10
12
"sync/atomic"
11
13
12
14
"github.com/bluesky-social/indigo/atproto/atcrypto"
···
26
28
27
29
// NewStore initializes a new SQLite-backed storage.
28
30
func NewStore(path string) (*Store, error) {
31
31
+
if dir := filepath.Dir(path); dir != "" && dir != "." {
32
32
+
if err := os.MkdirAll(dir, 0755); err != nil {
33
33
+
return nil, fmt.Errorf("failed to create directory for database: %w", err)
34
34
+
}
35
35
+
}
36
36
+
29
37
// Enable WAL mode for better concurrency
30
38
db, err := sql.Open("sqlite3", path+"?_journal_mode=WAL&_busy_timeout=5000")
31
39
if err != nil {