Skip to content

Commit

Permalink
feat: support custom encryption root key for local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Oct 13, 2023
1 parent 8d30ba2 commit 1450888
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/db/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ func NewContainerConfig() container.Config {
Timeout: 2 * time.Second,
Retries: 3,
},
Entrypoint: []string{"sh", "-c", `cat <<'EOF' > /etc/postgresql.schema.sql && docker-entrypoint.sh postgres -D /etc/postgresql
Entrypoint: []string{"sh", "-c", `cat <<'EOF' > /etc/postgresql.schema.sql && cat <<'EOF' > /etc/postgresql-custom/pgsodium_root.key && docker-entrypoint.sh postgres -D /etc/postgresql
` + initialSchema + `
EOF
` + utils.Config.Db.RootKey + `
EOF
`},
}
if utils.Config.Db.MajorVersion >= 14 {
Expand Down
4 changes: 3 additions & 1 deletion internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var Config = config{
Db: db{
Image: Pg15Image,
Password: "postgres",
RootKey: "d4dc5b6d4a1d6a10b2c1e76112c994d65db7cec380572cc1839624d4be3fa275",
},
Realtime: realtime{
IpVersion: AddressIPv6,
Expand Down Expand Up @@ -185,7 +186,7 @@ type (
config struct {
ProjectId string `toml:"project_id"`
Api api `toml:"api"`
Db db `toml:"db"`
Db db `toml:"db" mapstructure:"db"`
Realtime realtime `toml:"realtime"`
Studio studio `toml:"studio"`
Inbucket inbucket `toml:"inbucket"`
Expand All @@ -212,6 +213,7 @@ type (
ShadowPort uint `toml:"shadow_port"`
MajorVersion uint `toml:"major_version"`
Password string `toml:"-"`
RootKey string `toml:"-" mapstructure:"root_key"`
Pooler pooler `toml:"pooler"`
}

Expand Down

0 comments on commit 1450888

Please sign in to comment.