updated grpc client to have a proxy flag, updated coretk script to have a flag to enable proxy, disabled by default
This commit is contained in:
parent
583a552bdb
commit
d4bce0d25c
4 changed files with 18 additions and 8 deletions
|
@ -137,7 +137,7 @@ class CoreGrpcClient:
|
|||
Provides convenience methods for interfacing with the CORE grpc server.
|
||||
"""
|
||||
|
||||
def __init__(self, address="localhost:50051"):
|
||||
def __init__(self, address="localhost:50051", proxy=False):
|
||||
"""
|
||||
Creates a CoreGrpcClient instance.
|
||||
|
||||
|
@ -146,6 +146,7 @@ class CoreGrpcClient:
|
|||
self.address = address
|
||||
self.stub = None
|
||||
self.channel = None
|
||||
self.proxy = proxy
|
||||
|
||||
def start_session(
|
||||
self,
|
||||
|
@ -1036,7 +1037,7 @@ class CoreGrpcClient:
|
|||
:return: nothing
|
||||
"""
|
||||
self.channel = grpc.insecure_channel(
|
||||
self.address, options=[("grpc.enable_http_proxy", 0)]
|
||||
self.address, options=[("grpc.enable_http_proxy", self.proxy)]
|
||||
)
|
||||
self.stub = core_pb2_grpc.CoreApiStub(self.channel)
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ HEIGHT = 800
|
|||
|
||||
|
||||
class Application(tk.Frame):
|
||||
def __init__(self, master=None):
|
||||
super().__init__(master)
|
||||
def __init__(self, proxy):
|
||||
super().__init__(master=None)
|
||||
# load node icons
|
||||
NodeUtils.setup()
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Application(tk.Frame):
|
|||
self.guiconfig = appconfig.read()
|
||||
self.style = ttk.Style()
|
||||
self.setup_theme()
|
||||
self.core = CoreClient(self)
|
||||
self.core = CoreClient(self, proxy)
|
||||
self.setup_app()
|
||||
self.draw()
|
||||
self.core.set_up()
|
||||
|
|
|
@ -47,11 +47,11 @@ class Observer:
|
|||
|
||||
|
||||
class CoreClient:
|
||||
def __init__(self, app):
|
||||
def __init__(self, app, proxy):
|
||||
"""
|
||||
Create a CoreGrpc instance
|
||||
"""
|
||||
self.client = client.CoreGrpcClient()
|
||||
self.client = client.CoreGrpcClient(proxy=proxy)
|
||||
self.session_id = None
|
||||
self.node_ids = []
|
||||
self.app = app
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue