-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load config/appsignal.rb in diagnose CLI
Update the diagnose CLI to call the new `Appsignal._load_config!` PRIVATE method to initialize the config. This way we have less duplication of how the config is initialized and we can be sure it works the same in the diagnose CLI as well. I've introduced a new PRIVATE `_APPSIGNAL_CONFIG_FILE_ENV` env var to set the environment, but only in the diagnose CLI context. It's one of the few ways we can pass the default environment as set by the CLI to whatever config object gets initialized in the config file. I didn't use the `APPSIGNAL_APP_ENV` environment variable so the config option doesn't show up in the report as being set by an env var or overwrite it when the user has set it.
- Loading branch information
Showing
10 changed files
with
154 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
spec/support/fixtures/projects/valid_with_rails_app_with_config_rb/config/application.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "rails" | ||
|
||
module MyApp | ||
class Application < Rails::Application | ||
config.active_support.deprecation = proc { |message, stack| } | ||
config.eager_load = false | ||
|
||
def self.initialize! | ||
# Prevent errors about Rails being initialized more than once | ||
return if defined?(@initialized) | ||
|
||
super | ||
@initialized = true | ||
end | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
spec/support/fixtures/projects/valid_with_rails_app_with_config_rb/config/appsignal.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Appsignal.configure do |config| | ||
config.activate_if_environment(:production, :development, :test) | ||
config.name = "TestApp" | ||
config.push_api_key = "abc" | ||
config.enable_minutely_probes = false | ||
end |
5 changes: 5 additions & 0 deletions
5
spec/support/fixtures/projects/valid_with_rails_app_with_config_rb/config/environment.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Load the Rails application. | ||
require_relative "application" | ||
|
||
# Initialize the Rails application. | ||
MyApp::Application.initialize! |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters