Skip to content

Commit

Permalink
Updating based on peer feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tburtchell committed Feb 14, 2022
1 parent 04d4eba commit 108bfce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ private static void hitZitiService(String identityFile, String serviceName) {
ZitiContext zitiContext = null;
try {
zitiContext = Ziti.newContext(identityFile, "".toCharArray());
Thread.sleep(3000);

long end = System.currentTimeMillis() + 10000;

while (null == zitiContext.getService(serviceName) && System.currentTimeMillis() < end) {
log.info("Waiting for {} to become available", serviceName);
Thread.sleep(200);
}

if (null == zitiContext.getService(serviceName)) {
throw new IllegalArgumentException(String.format("Service %s is not available on the OpenZiti network",serviceName));
}

log.info("Dialing service");
ZitiConnection conn = zitiContext.dial(serviceName);
Expand Down
15 changes: 2 additions & 13 deletions network/express-network-config.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
hostsFileError() {
echo Error: The ziti edge controller or edge router hostname could not be resolved.
echo These commands can be used to configure the hosts if you are using the docker-compose environment:
echo 'echo "127.0.0.1 ziti-edge-controller" | sudo tee -a /etc/hosts'
echo 'echo "127.0.0.1 ziti-edge-router" | sudo tee -a /etc/hosts'
exit 1;
}

#echo Checking hosts file setup
#getent hosts ziti-edge-controller > /dev/null || { hostsFileError; }
#getent hosts ziti-edge-router > /dev/null || { hostsFileError; }

if !ziti edge list edge-routers > /dev/null 2>&1; then
echo "Error: Log into OpenZiti before running this script"
exit 1
fi

rm private-service.jwt client.jwt private-service.json client.json 2> /dev/null

echo Creating identities
ziti edge create identity device private-service -o private-service.jwt -a "services"
ziti edge create identity device client -o client.jwt -a "clients"
ziti edge create identity device zdew-client -o zdew-client.jwt -a "clients"

echo Enrolling identities
ziti edge enroll -j private-service.jwt
Expand Down

0 comments on commit 108bfce

Please sign in to comment.