From 3ab6e303b97195fbc1163a725370331ecfb33e18 Mon Sep 17 00:00:00 2001 From: Jeff Kreeftmeijer Date: Fri, 2 Mar 2018 14:51:28 +0100 Subject: [PATCH] Restore :revision config Closes #215. --- lib/appsignal/config.ex | 3 +++ test/appsignal/config_test.exs | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/appsignal/config.ex b/lib/appsignal/config.ex index 66fcd3457..8a940e3cb 100644 --- a/lib/appsignal/config.ex +++ b/lib/appsignal/config.ex @@ -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 """ diff --git a/test/appsignal/config_test.exs b/test/appsignal/config_test.exs index f47aebd96..9b0e6300a 100644 --- a/test/appsignal/config_test.exs +++ b/test/appsignal/config_test.exs @@ -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 @@ -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 @@ -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() @@ -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