Skip to content

Commit

Permalink
Restore :revision config
Browse files Browse the repository at this point in the history
Closes #215.
  • Loading branch information
jeffkreeftmeijer committed Mar 2, 2018
1 parent cdbb32b commit 3ab6e30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/appsignal/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ defmodule Appsignal.Config do
unless empty?(config[:files_world_accessible]) do
System.put_env("_APPSIGNAL_FILES_WORLD_ACCESSIBLE", to_string(config[:files_world_accessible]))
end
unless empty?(config[:revision]) do
System.put_env("APP_REVISION", to_string(config[:revision]))
end
end

@doc """
Expand Down
10 changes: 9 additions & 1 deletion test/appsignal/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ defmodule Appsignal.ConfigTest do
assert with_config(%{working_dir_path: "/tmp/appsignal"}, &init_config/0)
== default_configuration() |> Map.put(:working_dir_path, "/tmp/appsignal")
end

test "revision" do
assert with_config(%{revision: "03bd9e"}, &init_config/0)
== default_configuration() |> Map.put(:revision, "03bd9e")
end
end

describe "using the system environment" do
Expand Down Expand Up @@ -424,6 +429,7 @@ defmodule Appsignal.ConfigTest do
assert System.get_env("_APPSIGNAL_LOG_FILE_PATH") == nil
assert System.get_env("_APPSIGNAL_WORKING_DIR_PATH") == nil
assert System.get_env("_APPSIGNAL_RUNNING_IN_CONTAINER") == nil
assert System.get_env("APP_REVISION") == nil
end

test "deletes existing configuration in environment" do
Expand Down Expand Up @@ -464,7 +470,8 @@ defmodule Appsignal.ConfigTest do
name: "AppSignal test suite app",
running_in_container: false,
working_dir_path: "/tmp/appsignal",
files_world_accessible: false
files_world_accessible: false,
revision: "03bd9e"
}, fn() ->
write_to_environment()

Expand Down Expand Up @@ -492,6 +499,7 @@ defmodule Appsignal.ConfigTest do
assert System.get_env("_APPSIGNAL_SEND_PARAMS") == "true"
assert System.get_env("_APPSIGNAL_WORKING_DIR_PATH") == "/tmp/appsignal"
assert System.get_env("_APPSIGNAL_FILES_WORLD_ACCESSIBLE") == "false"
assert System.get_env("APP_REVISION") == "03bd9e"
end)
end

Expand Down

0 comments on commit 3ab6e30

Please sign in to comment.