Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamic configuration of http port in the unity sdk #1121

Merged

Conversation

roberthbailey
Copy link
Member

@dzlier-gcp -- I'm looking for feedback on the way that I'm getting the environment variable and converting it to an integer. This follows the pattern I implemented for Go / nodejs, but in the C++ sdk I went with a more concise solution (with less logging / error checking) since that was considered more stylistically correct.

Part of #851.

@roberthbailey roberthbailey changed the title Added dynamic configuration of http port. Added dynamic configuration of http port in the unity sdk Oct 16, 2019
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 97744ec9-8924-4d7a-87ec-9a7be37dfc2d

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1121/head:pr_1121 && git checkout pr_1121
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-b67ec4a

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 774a885e-c59a-43a0-8349-b5fc402cb63e

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1121/head:pr_1121 && git checkout pr_1121
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-d8eefaf

@@ -153,7 +184,7 @@ private async Task<bool> SendRequestAsync(string api, string json, string method
// To prevent that an async method leaks after destroying this gameObject.
cancellationTokenSource.Token.ThrowIfCancellationRequested();

var req = new UnityWebRequest(sidecarAddress + api, method)
var req = new UnityWebRequest(sidecarHost + ":" + sidecarPort + api, method)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more readable: String.Format("{0}:{1}{2}", sidecarHost, sidecarPort, api);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed this back to how it looked originally.

sdks/unity/AgonesSdk.cs Outdated Show resolved Hide resolved
Copy link
Contributor

@dzlier-gcp dzlier-gcp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is fine. In fact when this file was added I asked if that port was constant or if it should be a variable, and was assured it was a constant heh.

@roberthbailey
Copy link
Member Author

In fact when this file was added I asked if that port was constant or if it should be a variable, and was assured it was a constant heh.

It was ... until we found a bug and decided it needed to be changed. Since we can't ensure that whatever port we pick will always be free of conflicts, we decided to make it configurable.

@@ -58,6 +58,8 @@ private struct KeyValueMessage
// Use this for initialization.
private void Start()
{
String port = Environment.GetEnvironmentVariable("AGONES_SDK_HTTP_PORT");
sidecarAddress = "http://localhost:" + (port != null ? port : "59358");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet. I've updated it.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dzlier-gcp, pooneh-m, roberthbailey

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [dzlier-gcp,pooneh-m,roberthbailey]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: a591ca96-320c-448a-a441-fecee380eae7

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1121/head:pr_1121 && git checkout pr_1121
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-ecb609e

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 44c11c59-0413-4c37-a544-48954ba47d46

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1121/head:pr_1121 && git checkout pr_1121
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-a343963

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: e0bee085-f4e0-4e44-aad9-4c8b469569c5

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1121/head:pr_1121 && git checkout pr_1121
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.1.0-98d2ffa

@roberthbailey roberthbailey merged commit 1cded0a into googleforgames:master Oct 19, 2019
@markmandel markmandel added this to the 1.1.0 milestone Oct 22, 2019
@markmandel markmandel added the area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc label Oct 22, 2019
@markmandel markmandel added the kind/feature New features for Agones label Oct 22, 2019
@roberthbailey roberthbailey deleted the unity-sdk-dynamic-port branch August 24, 2020 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/feature New features for Agones size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants