Skip to content

Commit

Permalink
Some formatting of escript
Browse files Browse the repository at this point in the history
  • Loading branch information
vkatsuba committed Oct 9, 2024
1 parent 588fc25 commit 37fa2f0
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -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} ->
Expand Down

0 comments on commit 37fa2f0

Please sign in to comment.