Skip to content

Commit

Permalink
update lokalise error to include steps to fix no api token (#9848)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhao-stripe authored Jan 2, 2025
1 parent 184b2f6 commit d2e57cb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/lokalise/lokalise_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
require 'uri'

class LokaliseClient
def nil_api_token_error
abort("Missing LOKALISE_API_TOKEN environment variable. Try \nexport LOKALISE_API_TOKEN=$(fetch-password lokalise-api-token-manual)\nin terminal ")
end

def fetch_keys
fetch_keys_from_lokalise
Expand All @@ -21,7 +24,7 @@ def create_key(key_object)

api_token = ENV['LOKALISE_API_TOKEN']
if api_token.nil?
abort("Missing LOKALISE_API_TOKEN environment variable.")
nil_api_token_error()
else
request["X-Api-Token"] = api_token
end
Expand Down Expand Up @@ -77,7 +80,7 @@ def update_key(existing_key, key_object)

api_token = ENV['LOKALISE_API_TOKEN']
if api_token.nil?
abort("Missing LOKALISE_API_TOKEN environment variable.")
nil_api_token_error()
else
request["X-Api-Token"] = api_token
end
Expand Down Expand Up @@ -138,7 +141,7 @@ def fetch_keys_for_page(page)

api_token = ENV['LOKALISE_API_TOKEN']
if api_token.nil?
abort("Missing LOKALISE_API_TOKEN environment variable.")
nil_api_token_error()
else
request["X-Api-Token"] = api_token
end
Expand Down

0 comments on commit d2e57cb

Please sign in to comment.