Skip to content

Commit 93b39dd

Browse files
committed
update documentation
1 parent e6ef8d0 commit 93b39dd

File tree

1 file changed

+49
-0
lines changed
  • docs/quick-start/connecting-mysql

1 file changed

+49
-0
lines changed

docs/quick-start/connecting-mysql/page.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,55 @@ DB_DIALECT=mysql
4141
DB_CHARSET=utf8 #(optional)
4242
```
4343

44+
### TLS/SSL Configuration
45+
46+
GoFr supports secure TLS connections to MySQL/MariaDB databases. Configure TLS by setting the `DB_SSL_MODE` environment variable and optionally providing certificate paths for enhanced security.
47+
48+
#### Available SSL Modes
49+
50+
| SSL Mode | Description |
51+
|----------|-------------|
52+
| `disable` | No TLS encryption (default) |
53+
| `preferred` | Attempts TLS, falls back to plain connection if unavailable |
54+
| `require` | Enforces TLS but skips certificate validation |
55+
| `skip-verify` | Enforces TLS without validating server certificate |
56+
| `verify-ca` | Enforces TLS and validates server certificate against CA |
57+
| `verify-full` | Enforces TLS with full certificate validation (including hostname) |
58+
59+
#### TLS Environment Variables
60+
61+
| Variable | Required | Description |
62+
|----------|----------|-------------|
63+
| `DB_SSL_MODE` | No | TLS mode (defaults to `disable`) |
64+
| `DB_TLS_CA_CERT` | Conditional | Path to CA certificate (required for `verify-ca`/`verify-full`) |
65+
| `DB_TLS_CLIENT_CERT` | No | Path to client certificate (for mutual TLS) |
66+
| `DB_TLS_CLIENT_KEY` | No | Path to client private key (for mutual TLS) |
67+
68+
#### Example Configuration
69+
70+
```dotenv
71+
# configs/.env
72+
DB_HOST=localhost
73+
DB_USER=root
74+
DB_PASSWORD=root123
75+
DB_NAME=test_db
76+
DB_PORT=3306
77+
DB_DIALECT=mysql
78+
79+
# Basic TLS (no certificate validation)
80+
DB_SSL_MODE=require
81+
82+
# OR with CA certificate validation (production)
83+
DB_SSL_MODE=verify-ca
84+
DB_TLS_CA_CERT=/path/to/ca-cert.pem
85+
86+
# OR with mutual TLS (enhanced security)
87+
DB_SSL_MODE=verify-full
88+
DB_TLS_CA_CERT=/path/to/ca-cert.pem
89+
DB_TLS_CLIENT_CERT=/path/to/client-cert.pem
90+
DB_TLS_CLIENT_KEY=/path/to/client-key.pem
91+
```
92+
4493
## PostgreSQL
4594

4695
### Setup

0 commit comments

Comments
 (0)