+4
-4
nix/modules/spindle.nix
+4
-4
nix/modules/spindle.nix
···
35
description = "Address to listen on";
36
};
37
38
-
dbPath = mkOption {
39
type = types.path;
40
-
default = "/var/lib/spindle/spindle.db";
41
-
description = "Path to the database file";
42
};
43
44
hostname = mkOption {
···
150
StateDirectory = "spindle";
151
Environment = [
152
"SPINDLE_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
153
-
"SPINDLE_SERVER_DB_PATH=${cfg.server.dbPath}"
154
"SPINDLE_SERVER_HOSTNAME=${cfg.server.hostname}"
155
"SPINDLE_SERVER_PLC_URL=${cfg.server.plcUrl}"
156
"SPINDLE_SERVER_DEV=${lib.boolToString cfg.server.dev}"
···
35
description = "Address to listen on";
36
};
37
38
+
stateDir = mkOption {
39
type = types.path;
40
+
default = "/var/lib/spindle";
41
+
description = "Tangled spindle data directory";
42
};
43
44
hostname = mkOption {
···
150
StateDirectory = "spindle";
151
Environment = [
152
"SPINDLE_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}"
153
+
"SPINDLE_SERVER_DATA_DIR=${cfg.server.stateDir}"
154
"SPINDLE_SERVER_HOSTNAME=${cfg.server.hostname}"
155
"SPINDLE_SERVER_PLC_URL=${cfg.server.plcUrl}"
156
"SPINDLE_SERVER_DEV=${lib.boolToString cfg.server.dev}"
+1
-1
nix/vm.nix
+1
-1
nix/vm.nix
+6
-1
spindle/config/config.go
+6
-1
spindle/config/config.go
···
3
import (
4
"context"
5
"fmt"
6
7
"github.com/bluesky-social/indigo/atproto/syntax"
8
"github.com/sethvargo/go-envconfig"
···
10
11
type Server struct {
12
ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:6555"`
13
-
DBPath string `env:"DB_PATH, default=spindle.db"`
14
Hostname string `env:"HOSTNAME, required"`
15
TapUrl string `env:"TAP_URL, required"`
16
PlcUrl string `env:"PLC_URL, default=https://plc.directory"`
···
18
Owner syntax.DID `env:"OWNER, required"`
19
Secrets Secrets `env:",prefix=SECRETS_"`
20
LogDir string `env:"LOG_DIR, default=/var/log/spindle"`
21
QueueSize int `env:"QUEUE_SIZE, default=100"`
22
MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of jobs that run at a time
23
}
24
25
func (s Server) Did() syntax.DID {
26
return syntax.DID(fmt.Sprintf("did:web:%s", s.Hostname))
27
}
28
29
type Secrets struct {
···
3
import (
4
"context"
5
"fmt"
6
+
"path/filepath"
7
8
"github.com/bluesky-social/indigo/atproto/syntax"
9
"github.com/sethvargo/go-envconfig"
···
11
12
type Server struct {
13
ListenAddr string `env:"LISTEN_ADDR, default=0.0.0.0:6555"`
14
Hostname string `env:"HOSTNAME, required"`
15
TapUrl string `env:"TAP_URL, required"`
16
PlcUrl string `env:"PLC_URL, default=https://plc.directory"`
···
18
Owner syntax.DID `env:"OWNER, required"`
19
Secrets Secrets `env:",prefix=SECRETS_"`
20
LogDir string `env:"LOG_DIR, default=/var/log/spindle"`
21
+
DataDir string `env:"DATA_DIR, default=/var/lib/spindle"`
22
QueueSize int `env:"QUEUE_SIZE, default=100"`
23
MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of jobs that run at a time
24
}
25
26
func (s Server) Did() syntax.DID {
27
return syntax.DID(fmt.Sprintf("did:web:%s", s.Hostname))
28
+
}
29
+
30
+
func (s Server) DBPath() string {
31
+
return filepath.Join(s.DataDir, "spindle.db")
32
}
33
34
type Secrets struct {