Skip to content

Commit 35a60a9

Browse files
pavankrish123nebhale
authored andcommitted
Cloud Foundry-specific Configuration
This change adds default app-agent-config.xml file that excludes VCAP_* environment variables by default. This protects users in Cloud Foundry environments from exposing credentials from places like VCAP_SERVICES. [#684] Signed-off-by: Ben Hale <[email protected]>
1 parent 6a077fa commit 35a60a9

File tree

2 files changed

+721
-0
lines changed

2 files changed

+721
-0
lines changed

lib/java_buildpack/framework/app_dynamics_agent.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ class AppDynamicsAgent < JavaBuildpack::Component::VersionedDependencyComponent
2828
# (see JavaBuildpack::Component::BaseComponent#compile)
2929
def compile
3030
download_zip(false, @droplet.sandbox, 'AppDynamics Agent')
31+
32+
# acessor for resources dir through @droplet?
33+
resources_dir = Pathname.new(File.expand_path('../../../resources', __dir__)).freeze
34+
default_conf_dir = resources_dir + @droplet.component_id + 'defaults'
35+
36+
copy_appd_default_configuration(default_conf_dir)
37+
3138
@droplet.copy_resources
3239
end
3340

@@ -104,6 +111,18 @@ def tier_name(java_opts, credentials)
104111
java_opts.add_system_property('appdynamics.agent.tierName', name.to_s)
105112
end
106113

114+
# Copy default configuration present in resources folder of app_dynamics_agent ver* directories present in sandbox
115+
#
116+
# @param [Pathname] default_conf_dir the 'defaults' directory present in app_dynamics_agent resources.
117+
# @return [Void]
118+
def copy_appd_default_configuration(default_conf_dir)
119+
if default_conf_dir.exist?
120+
Dir.glob(@droplet.sandbox + 'ver*') do |target_directory|
121+
FileUtils.cp_r"#{default_conf_dir}/.", target_directory
122+
end
123+
end
124+
end
125+
107126
end
108127

109128
end

0 commit comments

Comments
 (0)