Skip to content

Commit

Permalink
fixup! 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 3, 2024
1 parent 0a2ccbc commit ae3c57f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 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_MODE_DISABLE: "true"
6 changes: 3 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

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
PostgresSslModeDisable 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.PostgresSslModeDisable = getPostgresSslModeDisable()
config.HttpAddress = getHttpAddress()
config.HttpPort = getHttpPort()
config.FeatureClaimerEnabled = getFeatureClaimerEnabled()
Expand Down
6 changes: 3 additions & 3 deletions internal/node/config/generate/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 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.PostgresSslModeDisable {
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_MODE_DISABLE="true"

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

0 comments on commit ae3c57f

Please sign in to comment.