Skip to content

Commit

Permalink
connection: handle NOMAD_CAPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamilcuk committed Jun 30, 2024
1 parent f643161 commit 70697c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/nomad_tools/nomadlib/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@

log = logging.getLogger(__name__)

NOMAD_ADDR = "NOMAD_ADDR"
NOMAD_NAMESPACE = "NOMAD_NAMESPACE"
NOMAD_TOKEN = "NOMAD_TOKEN"
NOMAD_HTTP_AUTH = "NOMAD_HTTP_AUTH"
NOMAD_SKIP_VERIFY = "NOMAD_SKIP_VERIFY"
NOMAD_CACERT = "NOMAD_CACERT"
NOMAD_CLIENT_CERT = "NOMAD_CLIENT_CERT"
NOMAD_CLIENT_KEY = "NOMAD_CLIENT_KEY"
NOMAD_CACERT = "NOMAD_CACERT"
NOMAD_CAPATH = "NOMAD_CACPATH"
NOMAD_SKIP_VERIFY = "NOMAD_SKIP_VERIFY"
NOMAD_TLS_SERVER_NAME = "NOMAD_TLS_SERVER_NAME"

if NOMAD_SKIP_VERIFY in os.environ:
urllib3.disable_warnings()
Expand Down Expand Up @@ -159,7 +162,7 @@ def nomad_version(self) -> str:

@staticmethod
def addr() -> str:
return os.environ.get("NOMAD_ADDR", "http://127.0.0.1:4646")
return os.environ.get(NOMAD_ADDR, "http://127.0.0.1:4646")

def request(
self,
Expand Down Expand Up @@ -193,6 +196,8 @@ def request(
if NOMAD_SKIP_VERIFY in os.environ
else os.environ[NOMAD_CACERT]
if NOMAD_CACERT in os.environ
else os.environ[NOMAD_CAPATH]
if NOMAD_CAPATH in os.environ
else True
),
cert=(
Expand Down

0 comments on commit 70697c1

Please sign in to comment.