Skip to content

Commit

Permalink
Merge pull request #48 from diagridio/updating-network
Browse files Browse the repository at this point in the history
Updating network usage
  • Loading branch information
salaboy committed May 16, 2024
2 parents 474e335 + 45e9109 commit 52182ab
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/main/java/io/diagrid/dapr/DaprContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public List<MetadataEntry> getMetadata() {
private DaprLogLevel daprLogLevel = DaprLogLevel.info;
private String appChannelAddress = "localhost";
private String placementService = "placement";
private Network daprNetwork = null;
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("daprio/daprd");
private Yaml yaml;
private DaprPlacementContainer placementContainer;
Expand Down Expand Up @@ -164,12 +163,6 @@ public DaprContainer withComponent(Component component) {
return this;
}

public DaprContainer withNetwork(Network network){
this.daprNetwork = network;
return this;
}


public DaprContainer withAppPort(Integer port) {
this.appPort = port;
return this;
Expand Down Expand Up @@ -289,25 +282,23 @@ public Map<String, Object> subscriptionToMap(Subscription subscription) {
protected void configure() {
super.configure();

if(this.daprNetwork == null){
this.daprNetwork = Network.newNetwork();
if(getNetwork() == null){
withNetwork(Network.newNetwork());
}
if (this.placementContainer == null) {
this.placementContainer = new DaprPlacementContainer(this.placementDockerImageName)
.withNetwork(this.daprNetwork)
.withNetwork(getNetwork())
.withNetworkAliases(placementService)
.withReuse(this.shouldReusePlacement);
this.placementContainer.start();
dependsOn(this.placementContainer);
withNetwork(this.daprNetwork);
}

withCommand(
"./daprd",
"-app-id", appName,
"--dapr-listen-addresses=0.0.0.0",
"--app-protocol", "http",
"-placement-host-address", placementService + ":" + 50006,
"-placement-host-address", placementService + ":50006",
"--app-channel-address", appChannelAddress,
"--app-port", Integer.toString(appPort),
"--log-level", daprLogLevel.toString(),
Expand Down Expand Up @@ -382,8 +373,4 @@ public DaprContainer withPlacementContainer(DaprPlacementContainer placementCont
return this;
}

public void setNetwork(Network network) {
this.daprNetwork = network;
}

}

0 comments on commit 52182ab

Please sign in to comment.