Skip to content

Commit dfbf271

Browse files
authored
Support SSL connection. v0.5.0 (#49)
Example: sqlant postgresql://sql:sql@localhost/sql?sslmode=require
1 parent 0ed97a0 commit dfbf271

File tree

8 files changed

+402
-16
lines changed

8 files changed

+402
-16
lines changed

.circleci/config.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
version: 2.1
22

33
jobs:
4+
build_musl_and_test_ssl:
5+
docker:
6+
- image: cimg/rust:1.83-node
7+
- image: cimg/postgres:17.1
8+
environment:
9+
POSTGRES_USER: sql
10+
POSTGRES_PASSWORD: sql
11+
POSTGRES_DB: sql
12+
entrypoint: bash
13+
command: >
14+
-c '
15+
openssl req -nodes -new -x509 -subj "/CN=localhost" -keyout /tmp/server.key -out /tmp/server.crt &&
16+
chown postgres /tmp/server.key &&
17+
chmod 600 /tmp/server.key &&
18+
exec /docker-entrypoint.sh -c ssl=on -c ssl_cert_file=/tmp/server.crt -c ssl_key_file=/tmp/server.key
19+
'
20+
steps:
21+
- checkout
22+
- run: sudo apt update
23+
- run: sudo apt-get install -y musl-tools
24+
- run: rustup target add x86_64-unknown-linux-musl
25+
- run: cargo build --release --target x86_64-unknown-linux-musl
26+
- run: psql -d postgresql://sql:sql@localhost/sql?sslmode=require -f ./tests/test_db.sql
27+
- run: ./target/x86_64-unknown-linux-musl/release/sqlant postgresql://sql:sql@localhost/sql?sslmode=require
28+
resource_class: small
29+
430
run_integration_and_smoke_tests:
531
docker:
6-
- image: cimg/rust:1.77-node
32+
- image: cimg/rust:1.83-node
733
environment:
834
TEST_DATABASE_URL: postgresql://sql:sql@localhost/sql
9-
- image: cimg/postgres:14.2
35+
- image: cimg/postgres:17.1
1036
environment:
1137
POSTGRES_USER: sql
1238
POSTGRES_PASSWORD: sql
@@ -67,4 +93,5 @@ jobs:
6793
workflows:
6894
default:
6995
jobs:
96+
- build_musl_and_test_ssl
7097
- run_integration_and_smoke_tests

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build and Run Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
services:
15+
postgres:
16+
image: postgis/postgis:15-3.3
17+
env:
18+
POSTGRES_USER: user
19+
POSTGRES_PASSWORD: password
20+
POSTGRES_DB: db
21+
options: >-
22+
--health-cmd pg_isready
23+
--health-interval 10s
24+
--health-timeout 5s
25+
--health-retries 5
26+
ports:
27+
- 5432:5432
28+
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v4
32+
33+
- name: Build Docker Image
34+
run: docker build -t sqlant .
35+
36+
- name: Setup Apt packages
37+
run: sudo apt update && sudo apt install -y postgresql-client
38+
39+
- name: Setup DB schema
40+
run: psql -d postgresql://user:password@localhost/db -f ./tests/test_db.sql
41+
42+
- name: Run Docker Image
43+
run: docker run --network host sqlant postgresql://user:password@localhost/db

0 commit comments

Comments
 (0)