Skip to content

Commit

Permalink
Fix using force_build from application config if defined
Browse files Browse the repository at this point in the history
Fixes #151
  • Loading branch information
paulgoetze committed Jul 12, 2024
1 parent 9d275bb commit 0f31940
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/mjml/native.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,21 @@ defmodule Mjml.Native do
2.16
)

use RustlerPrecompiled,
opts = [
otp_app: :mjml,
crate: "mjml_nif",
base_url: "#{github_url}/releases/download/v#{version}",
force_build: System.get_env("MJML_BUILD") in ["1", "true"],
version: version,
targets: targets,
nif_versions: nif_versions
]

use RustlerPrecompiled,
(if System.get_env("MJML_BUILD") in ["1", "true"] do
Keyword.put(opts, :force_build, true)
else
opts
end)

def to_html(_mjml, _render_options), do: error()
defp error(), do: :erlang.nif_error(:nif_not_loaded)
Expand Down

0 comments on commit 0f31940

Please sign in to comment.