Skip to content

Commit

Permalink
feat: Support tls app -> avs connection (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse S authored Aug 13, 2024
1 parent aa540cc commit 5b5a5df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions quote-semantic-search/quote-search/avs_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
host=Config.AVS_HOST,
port=Config.AVS_PORT,
),
root_certificate=Config.AVS_TLS_CA,
certificate_chain=Config.AVS_TLS_CERT,
private_key=Config.AVS_TLS_KEY,
listener_name=Config.AVS_ADVERTISED_LISTENER,
is_loadbalancer=Config.AVS_IS_LOADBALANCER,
)
Expand All @@ -17,6 +20,9 @@
host=Config.AVS_HOST,
port=Config.AVS_PORT,
),
root_certificate=Config.AVS_TLS_CA,
certificate_chain=Config.AVS_TLS_CERT,
private_key=Config.AVS_TLS_KEY,
listener_name=Config.AVS_ADVERTISED_LISTENER,
is_loadbalancer=Config.AVS_IS_LOADBALANCER,
)
20 changes: 19 additions & 1 deletion quote-semantic-search/quote-search/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def get_bool_env(name, default):
env = os.environ.get(name)
if env is None:
return default
env = env.lower()
env = env.lower()

if env in ["true", "1"]:
return True
Expand All @@ -20,6 +20,12 @@ class Config(object):
AVS_HOST = os.environ.get("AVS_HOST") or "localhost"
AVS_PORT = int(os.environ.get("AVS_PORT") or 5000)
AVS_ADVERTISED_LISTENER = os.environ.get("AVS_ADVERTISED_LISTENER") or None
AVS_TLS_CA_FILE = os.environ.get("AVS_TLS_CA_FILE") or None
AVS_TLS_CA = None
AVS_TLS_CERT_FILE = os.environ.get("AVS_TLS_CERT_FILE") or None
AVS_TLS_CERT = None
AVS_TLS_KEY_FILE = os.environ.get("AVS_TLS_KEY_FILE") or None
AVS_TLS_KEY = None
AVS_INDEX_NAME = os.environ.get("AVS_INDEX_NAME") or "quote-semantic-search"
AVS_NAMESPACE = os.environ.get("AVS_NAMESPACE") or "test"
AVS_SET = os.environ.get("AVS_SET") or "quote-data"
Expand All @@ -37,3 +43,15 @@ class Config(object):

if NUM_QUOTES > 100000:
NUM_QUOTES = 100000

if AVS_TLS_CA_FILE:
with open(AVS_TLS_CA_FILE, "rb") as f:
AVS_TLS_CA = f.read()

if AVS_TLS_CERT_FILE:
with open(AVS_TLS_CERT_FILE, "rb") as f:
AVS_TLS_CERT = f.read()

if AVS_TLS_KEY_FILE:
with open(AVS_TLS_KEY_FILE, "rb") as f:
AVS_TLS_KEY = f.read()
2 changes: 1 addition & 1 deletion quote-semantic-search/quote-search/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TODO: Include exact versions
# Aerospike dependencies
aerospike-vector-search==1.0.0
aerospike-vector-search==1.0.1


# Flask framework
Expand Down

0 comments on commit 5b5a5df

Please sign in to comment.