neiam /action-setup-beam
action-setup-beam
public · Issues · Pulls · Labels · Forks · Compare · Actions queued
⭐
Log in to mark this repository.
Add Postgres info to README
5b8160c · Jonathan Clem · 2020-01-08 19:05
Files changed
modified
README.md
+29
−0
@@ -91,6 +91,35 @@ jobs:
| 91 | 91 | - run: mix test |
| 92 | 92 | ``` |
| 93 | 93 | |
| 94 | +#### Authenticating with Postgres in Phoenix | |
| 95 | + | |
| 96 | +When using the Phoenix example above, the `postgres` container has some | |
| 97 | +default authentication set up. Specifically, it expects a username of | |
| 98 | +"postgres", and a password of "postgres". It will be available at | |
| 99 | +`localhost:5432`. | |
| 100 | + | |
| 101 | +The simplest way of setting these auth values in CI is by checking for the | |
| 102 | +`GITHUB_ACTIONS` environment variable that is set in all workflows: | |
| 103 | + | |
| 104 | +```elixir | |
| 105 | +# config/test.exs | |
| 106 | + | |
| 107 | +use Mix.Config | |
| 108 | + | |
| 109 | +# Configure the database for local testing | |
| 110 | +config :app, App.Repo, | |
| 111 | + database: "my_app_test", | |
| 112 | + hostname: "localhost", | |
| 113 | + pool: Ecto.Adapters.SQL.Sandbox | |
| 114 | + | |
| 115 | +# Configure the database for GitHub Actions | |
| 116 | +if System.get_env("GITHUB_ACTIONS") do | |
| 117 | + config :app, App.Repo, | |
| 118 | + username: "postgres", | |
| 119 | + password: "postgres" | |
| 120 | +end | |
| 121 | +``` | |
| 122 | + | |
| 94 | 123 | ## License |
| 95 | 124 | |
| 96 | 125 | The scripts and documentation in this project are released under the [MIT license](LICENSE.md). |
Parents: ef8325c