Skip to content

Commit

Permalink
Refactor database configuration for flexibility
Browse files Browse the repository at this point in the history
Introduced a .env file to store the DATABASE_URL, enhancing configuration management. Updated GitHub Actions workflow and example schema to use the environment variable. This change centralizes the database configuration and improves maintainability.
  • Loading branch information
eliasjpr committed Aug 13, 2024
1 parent dc5ed90 commit 2c2262b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgres://example:example@localhost:5432/example
Binary file added .github/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .github/workflows/crystal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
- name: Check code style
run: crystal tool format --check
- name: Run tests
env:
DATABASE_URL: postgres://example:example@localhost:5432/example
run: crystal spec

docs:
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/example.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "pg"
Example = Cql::Schema.build(
:example,
adapter: Cql::Adapter::Postgres,
uri: "postgres://example:example@localhost:5432/example") do
uri: ENV["DATABASE_URL"]) do
table :customers, as: "cust" do
primary :customer_id, Int64, auto_increment: true
column :customer_name, String, as: "cust_name"
Expand Down

0 comments on commit 2c2262b

Please sign in to comment.