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

Commit

Permalink
adding env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeale committed Aug 25, 2017
1 parent 3f3521a commit b728eb2
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 b728eb2

Please sign in to comment.