Skip to content

Commit

Permalink
fix: define project env on compile-time
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Sep 9, 2024
1 parent e17ec73 commit d8f6ff4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
from: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:dev
build-args: MIX_ENV="dev"
build-args: MIX_ENV=dev
target: builder

- name: Generate artifact attestation
Expand Down Expand Up @@ -182,7 +181,6 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
from: ./Dockerfile
push: true
tags: ${{ env.IMAGE_NAME }}:prod

Expand Down
4 changes: 3 additions & 1 deletion lib/pescarte.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
defmodule Pescarte do
@environment Application.compile_env!(:pescarte, :env)

def env do
Application.get_env(:pescarte, :env)
@environment
end

def get_static_file_path(folder, file) do
Expand Down
5 changes: 0 additions & 5 deletions lib/pescarte/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,5 @@ defmodule Pescarte.Application do
Pescarte.Supabase,
{Finch, name: PescarteHTTPClient}
]
|> maybe_append_children(Pescarte.env())
end

defp maybe_append_children(children, :test), do: children
# defp maybe_append_children(children, _), do: [ChromicPDF | children]
defp maybe_append_children(children, _), do: children
end

0 comments on commit d8f6ff4

Please sign in to comment.