Skip to content

Commit

Permalink
convienences for getting a dev env running (rauversion#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel authored Sep 26, 2022
1 parent 932227d commit 96fa802
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
# ports:
# - '5432:5432'
volumes:
- db:/var/lib/postgresql/data

Expand Down
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ SMTP_USERNAME=


# generate this with:
# 32 |> :crypto.strong_rand_bytes() |> Base.encode64()
# elixir --eval "IO.puts Base.encode64(:crypto.strong_rand_bytes(32))"
VAULT_KEY="xxxxx"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ npm-debug.log
/assets/*.log

.env

forks/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ To start your Phoenix server:
* Install dependencies with `mix deps.get`
* rename `.env.example` to `.env` and add your variable configurations
* Create and migrate your database with `mix ecto.setup`
* Create some fake accounts `mix fake_accounts`
* Compile assets `cd assets && yarn install & cd ..`
* Optionally create some fake accounts `mix fake_accounts`
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
# Setup:


### Generate fake accounts

Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Config
# Configure your database
config :rauversion, Rauversion.Repo,
username: "postgres",
password: "postgres",
password: System.get_env("POSTGRES_PASSWORD", "postgres"),
database: "rauversion_phx_dev",
hostname: System.get_env("DB_HOST", "localhost"),
show_sensitive_data_on_connection_error: true,
Expand Down
26 changes: 19 additions & 7 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ config :active_storage, :services,
root: "tmp/storage"
]

config :rauversion, Rauversion.Vault,
ciphers: [
default: {
Cloak.Ciphers.AES.GCM,
tag: "AES.GCM.V1", key: Base.decode64!(System.get_env("VAULT_KEY"))
}
]
key = System.get_env("VAULT_KEY")
with {:ok, key} <- Base.decode64(key) do
config :rauversion, Rauversion.Vault,
ciphers: [
default: {
Cloak.Ciphers.AES.GCM,
tag: "AES.GCM.V1", key: key
}
]
else _ ->
raise "Invalid key #{key} - please set env variable VAULT_KEY. You can generate one using: `elixir --eval 'IO.puts Base.encode64(:crypto.strong_rand_bytes(32))'`"
end


config :rauversion, google_maps_key: System.get_env("GOOGLE_MAPS_KEY")

Expand Down Expand Up @@ -158,4 +164,10 @@ if config_env() == :prod do
# ],
retries: 2,
no_mx_lookups: false

else

config :rauversion, Rauversion.Repo,
password: System.get_env("POSTGRES_PASSWORD", "postgres")

end

0 comments on commit 96fa802

Please sign in to comment.