Skip to content

Commit

Permalink
fix(db): Fix Schema postgres ssl mode handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoura committed Sep 5, 2024
1 parent 200601a commit 2206a7f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build/compose-devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ services:
CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED: "false"
CARTESI_AUTH_KIND: "mnemonic"
CARTESI_AUTH_MNEMONIC: "test test test test test test test test test test test junk"
CARTESI_POSTGRES_SSLMODE_ENABLED: "false"
CARTESI_POSTGRES_SSL_ENABLED: "false"
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ for more information.
* **Type:** `string`
* **Default:** `""`

## `CARTESI_POSTGRES_SSLMODE_ENABLED`
## `CARTESI_POSTGRES_SSL_ENABLED`

When enabled, will connect to postgres database via SSL.

Expand Down
4 changes: 2 additions & 2 deletions internal/node/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type NodeConfig struct {
ContractsInputBoxDeploymentBlockNumber int64
SnapshotDir string
PostgresEndpoint Redacted[string]
PostgresSslMode bool
PostgresSslDisabled bool
HttpAddress string
HttpPort int
FeatureClaimerEnabled bool
Expand Down Expand Up @@ -91,7 +91,7 @@ func FromEnv() NodeConfig {
config.ContractsInputBoxDeploymentBlockNumber = getContractsInputBoxDeploymentBlockNumber()
config.SnapshotDir = getSnapshotDir()
config.PostgresEndpoint = Redacted[string]{getPostgresEndpoint()}
config.PostgresSslMode = getPostgresSslmodeEnabled()
config.PostgresSslDisabled = !getPostgresSslEnabled()
config.HttpAddress = getHttpAddress()
config.HttpPort = getHttpPort()
config.FeatureClaimerEnabled = getFeatureClaimerEnabled()
Expand Down
2 changes: 1 addition & 1 deletion internal/node/config/generate/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ It is also possible to set the endpoint without a password and load it from Post
See [this](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-PASSFILE)
for more information."""

[postgres.CARTESI_POSTGRES_SSLMODE_ENABLED]
[postgres.CARTESI_POSTGRES_SSL_ENABLED]
default = "true"
go-type = "bool"
description = """
Expand Down
6 changes: 3 additions & 3 deletions internal/node/config/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/node/startup/startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// Validates the Node Database Schema Version
func ValidateSchema(config config.NodeConfig) error {
endpoint := config.PostgresEndpoint.Value
if config.PostgresSslMode {
if config.PostgresSslDisabled {
endpoint += "?sslmode=disable"
}

Expand Down
2 changes: 1 addition & 1 deletion setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export CARTESI_AUTH_MNEMONIC="test test test test test test test test test test
export CARTESI_POSTGRES_ENDPOINT="postgres://postgres:password@localhost:5432/postgres"
export CARTESI_HTTP_ADDRESS="0.0.0.0"
export CARTESI_HTTP_PORT="10000"
export CARTESI_POSTGRES_SSLMODE_ENABLED="false"
export CARTESI_POSTGRES_SSL_ENABLED="false"

rust_bin_path="$PWD/cmd/authority-claimer/target/debug"
# Check if the path is already in $PATH
Expand Down

0 comments on commit 2206a7f

Please sign in to comment.