Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Add --environment flag to sampleclient #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/content/services-packages/gateway/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We provide a [sample client](http://github.com/spatialos/online-services/tree/ma
1\. Navigate to `/services/csharp/SampleClient` and run:

```bash
dotnet run -- --google_project "{{your_google_project_id}}" --playfab_title_id "{{your_playfab_title_id}}"
dotnet run -- --google_project "{{your_google_project_id}}" --environment "{{your_environment}}" --playfab_title_id "{{your_playfab_title_id}}"
```

If you have set everything up correctly, you should see the script log in to PlayFab, obtain a PIT, create a party and then queue for a game. It won't get a match just yet though - you don't have any deployments that fit the matcher's criteria.
Expand Down
11 changes: 7 additions & 4 deletions services/csharp/SampleClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class SampleClientArguments
[Option("google_project", HelpText = "Google project ID", Required = true)]
public string GoogleProject { get; set; }

[Option("environment", HelpText = "Service environment", Required = true)]
public string Environment { get; set; }

[Option("playfab_title_id", HelpText = "PlayFab title ID", Required = true)]
public string PlayFabTitleId { get; set; }

Expand All @@ -30,7 +33,7 @@ public class SampleClientArguments
class Program
{
private const string LocalEndPointUrlFormat = "localhost:{0}";
private const string CloudEndPointUrlFormat = "{0}.endpoints.{1}.cloud.goog:4000";
private const string CloudEndPointUrlFormat = "{0}-{1}.endpoints.{2}.cloud.goog:4000";
private const string PitRequestHeaderName = "player-identity-token";

static void Main(string[] args)
Expand All @@ -41,15 +44,15 @@ static void Main(string[] args)
{
var gatewayServiceUrl = parsedArgs.Local
? string.Format(LocalEndPointUrlFormat, "4040")
: string.Format(CloudEndPointUrlFormat, "gateway", parsedArgs.GoogleProject);
: string.Format(CloudEndPointUrlFormat, "gateway", parsedArgs.Environment, parsedArgs.GoogleProject);

var partyServiceUrl = parsedArgs.Local
? string.Format(LocalEndPointUrlFormat, "4041")
: string.Format(CloudEndPointUrlFormat, "party", parsedArgs.GoogleProject);
: string.Format(CloudEndPointUrlFormat, "party", parsedArgs.Environment, parsedArgs.GoogleProject);

var authServiceUrl = parsedArgs.Local
? string.Format(LocalEndPointUrlFormat, "4042")
: string.Format(CloudEndPointUrlFormat, "playfab-auth", parsedArgs.GoogleProject);
: string.Format(CloudEndPointUrlFormat, "playfab-auth", parsedArgs.Environment, parsedArgs.GoogleProject);

var playerId = RandomString(15);
Console.WriteLine($"Using a randomly generated PlayFab player ID: {playerId}");
Expand Down