diff --git a/README.md b/README.md index 069ea67..2ecc611 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ read_timeout: 60 It will search for the following environment variables which may be in upper or lowercase (the official client defers to lower case, this is available here for compatibility). -- `REPORT_PORTAL_API_KEY` - the API Key for this Report Portal instance which must be created in advance +- `RP_API_KEY` - the API Key for this Report Portal instance which must be created in advance - `RP_ENDPOINT` - the endpoint for this Report Portal instance - `RP_PROJECT` - the Report Portal project name which must be created in advance and this user added as a member - `RP_LAUNCH` - the name of this 'launch' diff --git a/lib/parallel_report_portal/configuration.rb b/lib/parallel_report_portal/configuration.rb index bb16861..75fff86 100644 --- a/lib/parallel_report_portal/configuration.rb +++ b/lib/parallel_report_portal/configuration.rb @@ -14,7 +14,7 @@ module ParallelReportPortal # # == Environment variables # - # REPORT_PORTAL_API_KEY:: The API key required for authentication + # RP_API_KEY:: The API key required for authentication # RP_ENDPOINT:: the URL of the Report Portal API endpoint # RP_PROJECT:: the Report Portal project name -- this must already exist within Report Port and this user must be a member of the project # RP_LAUNCH:: The name of this launch @@ -61,7 +61,7 @@ class Configuration def initialize load_configuration_file ATTRIBUTES.each do |attr| - env_value = get_env("rp_#{attr.to_s}") || get_env("report_portal_#{attr.to_s}") + env_value = get_env("rp_#{attr.to_s}") send(:"#{attr}=", env_value) if env_value end @@ -153,8 +153,6 @@ def load_configuration_file ATTRIBUTES.each do |attr| yaml_key = if yaml.has_key?("rp_#{attr}".to_sym) "rp_#{attr}".to_sym - elsif yaml.has_key?("report_portal_#{attr}".to_sym) - "report_portal_#{attr}".to_sym else attr end diff --git a/spec/parallel_report_portal/configuration_spec.rb b/spec/parallel_report_portal/configuration_spec.rb index 0e6d30b..e0a622a 100644 --- a/spec/parallel_report_portal/configuration_spec.rb +++ b/spec/parallel_report_portal/configuration_spec.rb @@ -140,7 +140,7 @@ expect(Dir).to receive(:[]).with('./config/*').and_return([]) expect(Dir).to receive(:[]).with('./*').and_return(['./report_portal.yml']) expect(File).to receive(:read).with('./report_portal.yml').and_return(<<~CONFIG) - report_portal_api_key: 0a14044a-65fb-4981-b4b0-e699f99b4e59 + rp_api_key: 0a14044a-65fb-4981-b4b0-e699f99b4e59 rp_endpoint: https://url.local:10000/a/path rp_project: rp_project rp_launch: rp_launch_name @@ -163,7 +163,7 @@ expect(Dir).to receive(:[]).with('./config/*').and_return([]) expect(Dir).to receive(:[]).with('./*').and_return(['./report_portal.yml']) expect(File).to receive(:read).with('./report_portal.yml').and_return(<<~CONFIG) - REPORT_PORTAL_API_KEY: 0a14044a-65fb-4981-b4b0-e699f99b4e59 + RP_API_KEY: 0a14044a-65fb-4981-b4b0-e699f99b4e59 RP_ENDPOINT: https://url.local:10000/a/path RP_PROJECT: rp_project RP_LAUNCH: rp_launch_name @@ -220,14 +220,14 @@ expect(config.project).to eq(project) end - it 'accepts REPORT_PORTAL_API_KEY' do - api_key = ENV['REPORT_PORTAL_API_KEY'] = '0a14044a-65fb-4981-b4b0-e699f99b4e59' + it 'accepts RP_API_KEY' do + api_key = ENV['RP_API_KEY'] = '0a14044a-65fb-4981-b4b0-e699f99b4e59' config = ParallelReportPortal::Configuration.new expect(config.api_key).to eq(api_key) end - it 'accepts report_portal_api_key' do - api_key = ENV['report_portal_api_key'] = '0a14044a-65fb-4981-b4b0-e699f99b4e59' + it 'accepts rp_api_key' do + api_key = ENV['rp_api_key'] = '0a14044a-65fb-4981-b4b0-e699f99b4e59' config = ParallelReportPortal::Configuration.new expect(config.api_key).to eq(api_key) end