diff --git a/build/compose-devnet.yaml b/build/compose-devnet.yaml index 2be3edc1..bd90ed54 100644 --- a/build/compose-devnet.yaml +++ b/build/compose-devnet.yaml @@ -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_MODE_DISABLE: "true" diff --git a/docs/config.md b/docs/config.md index 67a4653a..c2b6990d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -216,12 +216,12 @@ for more information. * **Type:** `string` * **Default:** `""` -## `CARTESI_POSTGRES_SSLMODE_ENABLED` +## `CARTESI_POSTGRES_SSL_MODE_DISABLE` -When enabled, will connect to postgres database via SSL. +When POSTGRES SSL mode is disabled, will connect to postgres database without SSL. * **Type:** `bool` -* **Default:** `"true"` +* **Default:** `"false"` ## `CARTESI_EPOCH_LENGTH` diff --git a/internal/node/config/config.go b/internal/node/config/config.go index a67323e4..41133bce 100644 --- a/internal/node/config/config.go +++ b/internal/node/config/config.go @@ -30,7 +30,7 @@ type NodeConfig struct { ContractsInputBoxDeploymentBlockNumber int64 SnapshotDir string PostgresEndpoint Redacted[string] - PostgresSslMode bool + PostgresSslModeDisable bool HttpAddress string HttpPort int FeatureClaimerEnabled bool @@ -91,7 +91,7 @@ func FromEnv() NodeConfig { config.ContractsInputBoxDeploymentBlockNumber = getContractsInputBoxDeploymentBlockNumber() config.SnapshotDir = getSnapshotDir() config.PostgresEndpoint = Redacted[string]{getPostgresEndpoint()} - config.PostgresSslMode = getPostgresSslmodeEnabled() + config.PostgresSslModeDisable = getPostgresSslModeDisable() config.HttpAddress = getHttpAddress() config.HttpPort = getHttpPort() config.FeatureClaimerEnabled = getFeatureClaimerEnabled() diff --git a/internal/node/config/generate/Config.toml b/internal/node/config/generate/Config.toml index a1b9dfe2..2513d945 100644 --- a/internal/node/config/generate/Config.toml +++ b/internal/node/config/generate/Config.toml @@ -206,11 +206,11 @@ 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] -default = "true" +[postgres.CARTESI_POSTGRES_SSL_MODE_DISABLE] +default = "false" go-type = "bool" description = """ -When enabled, will connect to postgres database via SSL.""" +When POSTGRES SSL mode is disabled, will connect to postgres database without SSL.""" # # HTTP diff --git a/internal/node/config/generated.go b/internal/node/config/generated.go index 24c899e2..187b4fea 100644 --- a/internal/node/config/generated.go +++ b/internal/node/config/generated.go @@ -456,14 +456,14 @@ func getPostgresEndpoint() string { return val } -func getPostgresSslmodeEnabled() bool { - s, ok := os.LookupEnv("CARTESI_POSTGRES_SSLMODE_ENABLED") +func getPostgresSslModeDisable() bool { + s, ok := os.LookupEnv("CARTESI_POSTGRES_SSL_MODE_DISABLE") if !ok { - s = "true" + s = "false" } val, err := toBool(s) if err != nil { - panic(fmt.Sprintf("failed to parse CARTESI_POSTGRES_SSLMODE_ENABLED: %v", err)) + panic(fmt.Sprintf("failed to parse CARTESI_POSTGRES_SSL_MODE_DISABLE: %v", err)) } return val } diff --git a/internal/node/startup/startup.go b/internal/node/startup/startup.go index 9ca1eb53..f018cd6d 100644 --- a/internal/node/startup/startup.go +++ b/internal/node/startup/startup.go @@ -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.PostgresSslModeDisable { endpoint += "?sslmode=disable" } diff --git a/setup_env.sh b/setup_env.sh index 5b3fbf1a..98e3d996 100644 --- a/setup_env.sh +++ b/setup_env.sh @@ -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_MODE_DISABLE="true" rust_bin_path="$PWD/cmd/authority-claimer/target/debug" # Check if the path is already in $PATH