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

Commit

Permalink
Merge pull request #168 from librato/add-env-vars
Browse files Browse the repository at this point in the history
adding env vars
  • Loading branch information
mbeale authored Aug 28, 2017
2 parents 3f3521a + b728eb2 commit e70000d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion librato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import platform
import time
import logging
import os
from six.moves import http_client
from six.moves import map
from six import string_types
Expand Down Expand Up @@ -560,11 +561,15 @@ def set_timeout(self, timeout):
self.timeout = timeout


def connect(username, api_key, hostname=HOSTNAME, base_path=BASE_PATH, sanitizer=sanitize_no_op,
def connect(username=None, api_key=None, hostname=HOSTNAME, base_path=BASE_PATH, sanitizer=sanitize_no_op,
protocol="https", tags={}):
"""
Connect to Librato Metrics
"""

username = username if username else os.getenv('LIBRATO_USER', '')
api_key = api_key if api_key else os.getenv('LIBRATO_TOKEN', '')

return LibratoConnection(username, api_key, hostname, base_path, sanitizer=sanitizer, protocol=protocol, tags=tags)


Expand Down

0 comments on commit e70000d

Please sign in to comment.