From 0f31940f99dbbf7e790403624346d59bacee1d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20G=C3=B6tze?= Date: Fri, 12 Jul 2024 10:41:36 +0200 Subject: [PATCH] Fix using force_build from application config if defined Fixes #151 --- lib/mjml/native.ex | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/mjml/native.ex b/lib/mjml/native.ex index 735327d..77c533a 100644 --- a/lib/mjml/native.ex +++ b/lib/mjml/native.ex @@ -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)