Skip to content

Commit 920bd5f

Browse files
authored
add localhost env (#59)
1 parent 204ab27 commit 920bd5f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/text_files/python_stubs_py_template.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
{{ Services class code }}
55

66

7+
from os import environ
8+
USE_LOCALHOST = environ.get('AIAAS_GRPC_USE_LOCALHOST', 'False').lower() == 'true'
9+
710
def get_stub(config: dict):
8-
channel = grpc.insecure_channel(config['host'] + ':' + str(config['port']))
11+
host = '127.0.0.1' if USE_LOCALHOST else config['host']
12+
channel = grpc.insecure_channel(host + ':' + str(config['port']))
913
return config['stub_class'](channel)

0 commit comments

Comments
 (0)