Skip to content

Commit 05c83ca

Browse files
Lasse Benningaclaude
andcommitted
fix(week10): require SSL for Azure Postgres + add .env.example
- profiles.yml.example: add sslmode: require (Azure Database for PostgreSQL needs an encrypted connection). - add .env.example with PG_* exports so students copy to .env, fill in the password, and source it instead of retyping exports. - README Task 1: switch from ad-hoc exports to the cp .env.example .env + source .env flow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8601a78 commit 05c83ca

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Connection settings for the shared Azure PostgreSQL database.
2+
#
3+
# 1. Copy this file to .env: cp .env.example .env
4+
# 2. Fill in the real values below (the class vault has them; ask your mentor if any are missing).
5+
# 3. Load them into your shell before running dbt: source .env
6+
#
7+
# .env is git-ignored — never commit it with a real password.
8+
9+
export PG_HOST=<your-server>.postgres.database.azure.com
10+
export PG_USER=<your_login>
11+
export PG_PASSWORD=<your_password>
12+
export PG_DBNAME=postgres

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This repo is a **ready-to-run dbt project**: the project config is wired up and
1515
├── dbt_project.yml <- ready to run: staging = view, marts = table
1616
├── packages.yml <- TODO stub: declare dbt_utils (Task 5)
1717
├── profiles.yml.example <- connection template: copy to profiles.yml
18+
├── .env.example <- env var template: copy to .env, fill in, then source it
1819
├── macros/
1920
│ └── safe_divide.sql <- TODO stub: implement the macro
2021
├── models/
@@ -46,15 +47,16 @@ cp profiles.yml.example profiles.yml
4647
# edit profiles.yml: replace <your_name> so schema reads dev_<your_name>
4748
```
4849

49-
2. Export the connection env vars (values are in the class vault; ask your mentor if you are missing them):
50+
2. Set the connection env vars (values are in the class vault; ask your mentor if you are missing them). Copy the template, fill in the real values, and load them into your shell:
5051

5152
```bash
52-
export PG_HOST=...
53-
export PG_USER=...
54-
export PG_PASSWORD=...
55-
export PG_DBNAME=postgres
53+
cp .env.example .env
54+
# edit .env: fill in PG_HOST, PG_USER, PG_PASSWORD (PG_DBNAME stays postgres)
55+
source .env
5656
```
5757

58+
`.env` is git-ignored, so your password stays out of Git. Run `source .env` again in any new terminal before running dbt.
59+
5860
3. Verify: `dbt debug` must end with `All checks passed!`.
5961

6062
`profiles.yml` is git-ignored. Never commit it: the autograder treats a committed `profiles.yml` as a blocker.

profiles.yml.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ nyc_taxi_borough_daily:
99
password: "{{ env_var('PG_PASSWORD') }}"
1010
dbname: "{{ env_var('PG_DBNAME', 'postgres') }}"
1111
schema: "dev_<your_name>" # TODO: replace <your_name> with your first name (the schema you already own)
12+
sslmode: require # Azure Database for PostgreSQL requires an encrypted connection
1213
threads: 1
1314

1415
# Copy this file to profiles.yml (same directory), fill in your name, and ensure
1516
# PG_HOST, PG_USER, PG_PASSWORD, and PG_DBNAME are set in your environment.
17+
# The quickest way to set them: cp .env.example .env, fill in .env, then run: source .env
1618
# profiles.yml is git-ignored — never commit it with a real password.

0 commit comments

Comments
 (0)