Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #21 from pipefy/eh-main/feature/pidfile-path
Browse files Browse the repository at this point in the history
refact: remove validation Aws.config
  • Loading branch information
eHattori authored May 20, 2022
2 parents 59ad46a + 9d04a54 commit d5afa76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 8 additions & 0 deletions bin/pipefymessage
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ module PipefyMessage
desc "start", "Starts PipefyMessage consumer"
method_option :worker, aliases: "-w", type: :string, desc: "Worker to load"
method_option :rails, aliases: "-R", type: :boolean, desc: "Load Rails", default: false
method_option :pidfile, aliases: "-P", type: :string, desc: "Path to pidfile"
def start
PipefyMessage::Runner.instance.initialize_rails if options[:rails]
PipefyMessage::Runner.instance.write_pid(options) if options[:pidfile]
PipefyMessage::Runner.instance.run(options[:worker]) if options[:worker]
end
end
Expand All @@ -35,6 +37,12 @@ module PipefyMessage
end
end

def write_pid(options)
return unless (path = options[:pidfile])

File.open(path, "w") { |f| f.puts(Process.pid) }
end

def run(worker)
worker.constantize.process_message
end
Expand Down
3 changes: 0 additions & 3 deletions lib/pipefy_message/providers/aws_client/aws_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ module AwsClient
##
# Sets up AWS options the first time an AWS service is used.
def self.aws_setup
return unless Aws.config.empty?

logger.info({ message_text: "AWS configurations set" })

Aws.config.update(retrieve_config)
end

Expand Down
1 change: 1 addition & 0 deletions spec/providers/aws/aws_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def initialize
TestClient.new

ENV["AWS_CLI_STUB_RESPONSE"] = "false"
ENV["ENABLE_AWS_CLIENT_CONFIG"] = "false"
TestClient.new

expect(Aws.config).to eq aws_opts
Expand Down

0 comments on commit d5afa76

Please sign in to comment.