Phase 10, part 9: the server package
compose.server.yaml runs Supermarket behind Caddy (HTTPS from Let's Encrypt, Caddy's own CA or the team's), with Postgres on an internal network and a nightly pg_dump kept two weeks. install-server.sh asks for the domain, certificate and mail server, makes the secret key and database password, starts it all and prints the setup link. Settings → Backups lists the dumps on a server, and how the operator restores one. Checked end to end in Docker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,8 @@ type Config struct {
|
||||
SecretKey []byte // 32 bytes that encrypt secrets in the database; nil if not set
|
||||
OldKey []byte // the key being replaced: secrets under it are encrypted again with SecretKey
|
||||
Storage Storage
|
||||
Mail *Mail // nil if not set
|
||||
Mail *Mail // nil if not set
|
||||
PGBackups string // where the server's nightly dumps are, to list them; "" if not known
|
||||
}
|
||||
|
||||
// Environment variables.
|
||||
@@ -115,6 +116,7 @@ const (
|
||||
EnvS3SecretKey = "SUPERMARKET_S3_SECRET_KEY"
|
||||
EnvMailURL = "SUPERMARKET_MAIL_URL"
|
||||
EnvMailFrom = "SUPERMARKET_MAIL_FROM"
|
||||
EnvPGBackups = "SUPERMARKET_PG_BACKUPS"
|
||||
)
|
||||
|
||||
// Load reads the settings through getenv (os.Getenv) and checks them. All
|
||||
@@ -208,6 +210,8 @@ func Load(getenv func(string) string) (*Config, error) {
|
||||
bad("%s is needed on the %s edition, to send invitations and password resets: smtp://user:password@mail.example.com:587", EnvMailURL, c.Edition.Name())
|
||||
}
|
||||
|
||||
c.PGBackups = get(EnvPGBackups, "")
|
||||
|
||||
if len(problems) > 0 {
|
||||
return c, errors.New(strings.Join(problems, "\n"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user