Skip to content

Commit dc08a6c

Browse files
michaelmcneesclaude
andcommitted
fix: update QuickStart guide and SSL config for local Postgres dev
The default database URL used sslmode=require, but the docker-compose Postgres has no SSL configured — causing mantle init to fail for users following the QuickStart guide. Change the code default to sslmode=disable (matching the docs and the localhost dev URL) and add SSL guidance to the Getting Started guide. Production examples throughout the docs already use sslmode=require. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8100636 commit dc08a6c

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

docs/getting-started.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ make build
3434

3535
The `docker compose up -d` command starts Postgres 16 on `localhost:5432` with user `mantle`, password `mantle`, and database `mantle`. The `make build` command produces a single `mantle` binary in the project root. The `mantle init` command creates all required database tables.
3636

37+
The default database URL uses `sslmode=disable`, which is correct for local development with the provided Docker Compose setup. For production, always use `sslmode=require` or `sslmode=verify-full`:
38+
39+
```bash
40+
export MANTLE_DATABASE_URL="postgres://mantle:secret@db.example.com:5432/mantle?sslmode=require"
41+
```
42+
43+
See [Configuration](configuration.md) for all database options.
44+
3745
You should see:
3846

3947
```

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func Load(cmd *cobra.Command) (*Config, error) {
129129
v := viper.New()
130130

131131
// Defaults
132-
v.SetDefault("database.url", "postgres://mantle:mantle@localhost:5432/mantle?sslmode=require")
132+
v.SetDefault("database.url", "postgres://mantle:mantle@localhost:5432/mantle?sslmode=disable")
133133
v.SetDefault("database.max_open_conns", 25)
134134
v.SetDefault("database.max_idle_conns", 25)
135135
v.SetDefault("database.conn_max_lifetime", 5*time.Minute)

internal/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestLoad_Defaults(t *testing.T) {
2929
t.Fatalf("Load() error = %v", err)
3030
}
3131

32-
if cfg.Database.URL != "postgres://mantle:mantle@localhost:5432/mantle?sslmode=require" {
32+
if cfg.Database.URL != "postgres://mantle:mantle@localhost:5432/mantle?sslmode=disable" {
3333
t.Errorf("Database.URL = %q, want default", cfg.Database.URL)
3434
}
3535
if cfg.API.Address != ":8080" {
@@ -97,7 +97,7 @@ func TestLoad_ImplicitConfigMissing_UsesDefaults(t *testing.T) {
9797
t.Fatalf("Load() error = %v, want nil (silent fallback)", err)
9898
}
9999

100-
if cfg.Database.URL != "postgres://mantle:mantle@localhost:5432/mantle?sslmode=require" {
100+
if cfg.Database.URL != "postgres://mantle:mantle@localhost:5432/mantle?sslmode=disable" {
101101
t.Errorf("Database.URL = %q, want default", cfg.Database.URL)
102102
}
103103
}

site/src/content/docs/getting-started/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ make build
3434

3535
The `docker compose up -d` command starts Postgres 16 on `localhost:5432` with user `mantle`, password `mantle`, and database `mantle`. The `make build` command produces a single `mantle` binary in the project root. The `mantle init` command creates all required database tables.
3636

37+
The default database URL uses `sslmode=disable`, which is correct for local development with the provided Docker Compose setup. For production, always use `sslmode=require` or `sslmode=verify-full`:
38+
39+
```bash
40+
export MANTLE_DATABASE_URL="postgres://mantle:secret@db.example.com:5432/mantle?sslmode=require"
41+
```
42+
43+
See [Configuration](/configuration) for all database options.
44+
3745
You should see:
3846

3947
```

0 commit comments

Comments
 (0)