From 37fa2f0037c6488e685a4a1893070938293f9610 Mon Sep 17 00:00:00 2001 From: vk Date: Wed, 9 Oct 2024 12:19:19 +0300 Subject: [PATCH] Some formatting of escript --- rebar.config.script | 8 -------- 1 file changed, 8 deletions(-) diff --git a/rebar.config.script b/rebar.config.script index 25c1cb8..efa1035 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -3,27 +3,19 @@ case file:read_file("priv/swagger/swagger-initializer.js") of {ok, Content} -> %% Get the configuration for the path from the application configuration Path = application:get_env(cowboy_swagger, path, "/api-docs"), - %% Ensure Path is a binary (if it's a list, convert to binary) BinPath = case is_binary(Path) of true -> Path; false -> list_to_binary(Path) end, - %% Determine the path to the JavaScript file FilePath = "priv/swagger/swagger-initializer.js", - - - %% Replace the placeholder in the file contents %% Ensure both the placeholder and replacement are binaries ModifiedContent = binary:replace(Content, <<"__SWAGGER_PATH__">>, <<"\'", BinPath/binary, "\'">>, [global]), - %% Write the updated file back ok = file:write_file(FilePath, ModifiedContent), - %% Successfully complete hook execution - io:format("Swagger path updated to: ~s~n", [Path]), CONFIG; {error, Reason} ->