diff --git a/.gitignore b/.gitignore index 33c51e90..3689e865 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ nodejs/opentelemetry-instrumentation-bullmq .DS_Store appsignal_key.env +.appsignal_environment +appsignal_key_*.env .env yarn-error.log node_modules diff --git a/Rakefile b/Rakefile index d9be014c..3ffdef5c 100644 --- a/Rakefile +++ b/Rakefile @@ -91,6 +91,29 @@ def render_erb(file) ERB.new(File.read(file)).result end +namespace :env do + desc "Send data to local devenv" + task :local do + FileUtils.cp "./appsignal_key_local.env", "./appsignal_key.env" + File.write ".appsignal_environment", "local" + end + task :dev => :local + task :development => :local + + desc "Send data to staging" + task :prod do + FileUtils.cp "./appsignal_key_prod.env", "./appsignal_key.env" + File.write ".appsignal_environment", "production" + end + task :production => :prod + + desc "Send data to production" + task :staging do + FileUtils.cp "./appsignal_key_staging.env", "./appsignal_key.env" + File.write ".appsignal_environment", "staging" + end +end + namespace :app do desc "Open the browser pointing to the app" task :open do @@ -138,6 +161,13 @@ namespace :app do @app = get_app puts "Starting #{@app}" + if File.exist?(".appsignal_environment") + env = File.read(".appsignal_environment").strip.upcase + puts "=" * 50 + puts "ENVIRONMENT: #{env}" + puts "=" * 50 + end + puts "Copying processmon" FileUtils.rm_f "#{@app}/commands/processmon" FileUtils.cp "support/processmon/processmon", "#{@app}/commands/"