Class: Peatio::Command::Service::Start::Ranger

Inherits:
Base
  • Object
show all
Defined in:
lib/peatio/command/service.rb

Instance Method Summary collapse

Methods inherited from Base

#say, #sql_client

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/peatio/command/service.rb', line 4

def execute
  if ENV["JWT_PUBLIC_KEY"].nil?
    raise ArgumentError, "JWT_PUBLIC_KEY was not specified."
  end

  key_decoded = Base64.urlsafe_decode64(ENV["JWT_PUBLIC_KEY"])

  jwt_public_key = OpenSSL::PKey.read(key_decoded)
  if jwt_public_key.private?
    raise ArgumentError, "JWT_PUBLIC_KEY was set to private key, however it should be public."
  end

  ::Peatio::Ranger.run!(jwt_public_key)
end