Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 54bbedb

Browse files
author
Jamie Brynes
authored
Use correct platform API endpoint for DAT in Deployment Launcher (#1366)
1 parent 0266b65 commit 54bbedb

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Invalid JSON is now logged if there is an error parsing the codegen output. [#1353](https://github.com/spatialos/gdk-for-unity/pull/1353)
2323
- The Mobile Launcher will no longer break if Android build support is not installed. [#1354](https://github.com/spatialos/gdk-for-unity/pull/1354)
2424
- Fixed a bug in the `EntityTemplate` class where calling `AddComponent` with an `EntityAcl.Snapshot` would incorrectly apply its write access [#1360](https://github.com/spatialos/gdk-for-unity/pull/1360)
25+
- The Deployment Launcher will now generate Dev Auth Tokens using the environment specified in the GDK Tools Configuration. [#1366](https://github.com/spatialos/gdk-for-unity/pull/1366)
2526

2627
### Internal
2728

workers/unity/Packages/io.improbable.gdk.deploymentlauncher/.DeploymentLauncher/ClientFactory.cs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using Improbable.SpatialOS.Deployment.V1Alpha1;
55
using Improbable.SpatialOS.Platform.Common;
6+
using Improbable.SpatialOS.PlayerAuth.V2Alpha1;
67
using Improbable.SpatialOS.Snapshot.V1Alpha1;
78

89
namespace Improbable.Gdk.DeploymentLauncher
@@ -13,14 +14,24 @@ public static DeploymentServiceClient CreateDeploymentClient(Options.Common opti
1314
{
1415
return string.IsNullOrEmpty(options.Environment)
1516
? DeploymentServiceClient.Create()
16-
: DeploymentServiceClient.Create(GetEndpoint(options.Environment), GetTokenCredential(options.Environment));
17+
: DeploymentServiceClient.Create(GetEndpoint(options.Environment),
18+
GetTokenCredential(options.Environment));
1719
}
1820

1921
public static SnapshotServiceClient CreateSnapshotClient(Options.Common options)
2022
{
2123
return string.IsNullOrEmpty(options.Environment)
2224
? SnapshotServiceClient.Create()
23-
: SnapshotServiceClient.Create(GetEndpoint(options.Environment), GetTokenCredential(options.Environment));
25+
: SnapshotServiceClient.Create(GetEndpoint(options.Environment),
26+
GetTokenCredential(options.Environment));
27+
}
28+
29+
public static PlayerAuthServiceClient CreatePlayerAuthClient(Options.Common options)
30+
{
31+
return string.IsNullOrEmpty(options.Environment)
32+
? PlayerAuthServiceClient.Create()
33+
: PlayerAuthServiceClient.Create(GetEndpoint(options.Environment),
34+
GetTokenCredential(options.Environment));
2435
}
2536

2637
private static PlatformApiEndpoint GetEndpoint(string environment)
@@ -54,8 +65,10 @@ private static string GetRefreshToken(string environment)
5465
var possibleTokenFiles = new[]
5566
{
5667
Environment.GetEnvironmentVariable("SPATIALOS_REFRESH_TOKEN_FILE"),
57-
Path.Combine(Environment.GetEnvironmentVariable("HOME") ?? "", $".improbable/oauth2/oauth2_refresh_token_{environment}"),
58-
Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"), $".improbable/oauth2/oauth2_refresh_token_{environment}")
68+
Path.Combine(Environment.GetEnvironmentVariable("HOME") ?? "",
69+
$".improbable/oauth2/oauth2_refresh_token_{environment}"),
70+
Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"),
71+
$".improbable/oauth2/oauth2_refresh_token_{environment}")
5972
};
6073

6174
var tokenFile = possibleTokenFiles.FirstOrDefault(File.Exists);

workers/unity/Packages/io.improbable.gdk.deploymentlauncher/.DeploymentLauncher/Commands/Create.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private static int CreateDeploymentInternal<TOptions>(TOptions options, Func<TOp
103103

104104
private static string ModifySimulatedPlayerLaunchJson(Options.CreateSimulated options)
105105
{
106-
var playerAuthServiceClient = PlayerAuthServiceClient.Create();
106+
var playerAuthServiceClient = ClientFactory.CreatePlayerAuthClient(options);
107107

108108
// Create development authentication token used by the simulated players.
109109
var dat = playerAuthServiceClient.CreateDevelopmentAuthenticationToken(

0 commit comments

Comments
 (0)