Skip to content

Commit

Permalink
Merge pull request #60 from runeberry/v2.2
Browse files Browse the repository at this point in the history
V2.2
  • Loading branch information
dolphinspired authored Jun 15, 2023
2 parents 3bb9388 + b929d2c commit 64c45f6
Show file tree
Hide file tree
Showing 104 changed files with 4,137 additions and 1,822 deletions.
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ Users will be notified that an update is available the next time they open the d

You only need to run the Serverless application locally if you're making changes to the REST API that you want to test. If you're just making changes to the desktop client, you can skip this section.

To run the serverless application locally:
To run the serverless application locally (Visual Studio 2022):

1. Select the **ValheimServerGUI.Serverless** project (or any file in that project) in the Solution Explorer in Visual Studio.
2. Press **F5** or click the play button to start debugging the application. This will launch a console window.
1. Right-click the **ValheimServerGUI.Serverless** project in the Solution Explorer, and select "Set as Startup Project".
2. Press **F5** or click the play button to start debugging the application in IIS Express. This will launch a new browser window.
3. Using a REST client of your choice (such as [Postman](https://www.postman.com/downloads/) or just cURL), you can then query any API route using the base address shown in the console. For example:

```bash
curl --header "Content-Type: application/json" \
--request POST \
--data '{}' \
http://localhost:5000/crash-report
http://localhost:44385/crash-report
```

### Publishing the Serverless API
Expand All @@ -96,8 +96,7 @@ _For project maintainers only._
The API is published to AWS using the [Serverless Application Model](https://aws.amazon.com/serverless/sam/), which essentially means that the deployment instructions are contained within a CloudFormation template in this repo - namely, [serverless.template](/ValheimServerGUI.Serverless/serverless.template).

Before publishing, ensure that the following Solution Resources are set up locally:
* appsettings.secret.json
* Secrets.Values.cs
* ServerSecrets.Values.cs

The easiest way to publish the API is to install the [AWS Toolkit Extension](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.AWSToolkitforVisualStudio2017) for Visual Studio. After installing the extension, follow these steps:

Expand Down
3 changes: 1 addition & 2 deletions SolutionResources/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ValheimServerGUI.snk
appsettings.secret.json
appsettings.local.json
Secrets.Values.cs
*Secrets.*.cs
19 changes: 19 additions & 0 deletions SolutionResources/ClientSecrets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace ValheimServerGUI.Properties
{
/// <summary>
/// The values in this class are populated by the static constructor in the corresponding
/// partial class, which is kept out of source control.
/// </summary>
public static partial class ClientSecrets
{
/// <summary>
/// The HTTP header that will contain the API key for requests made to the Runeberry API.
/// </summary>
public static string RuneberryApiKeyHeader { get; } = string.Empty;

/// <summary>
/// The API key that will be attached to all VSG client requests to the Runeberry API.
/// </summary>
public static string RuneberryClientApiKey { get; }
}
}
14 changes: 2 additions & 12 deletions SolutionResources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ In some cases, however, you may want to supply your own mock secret values for t

This is only needed when publishing the desktop client application in the Release configuration. If you need to publish the application locally for some reason, simply change the Publish Profile (.pubxml) to publish to Debug configuration temporarily.

### Secrets.Values.cs
### ClientSecrets.Values.cs

This is a... "clever" way of providing secret information to both the client and Serverless applications at compile time. Use this partial static class to set the values of any properties in **Secrets.cs**.
This is a... "clever" way of providing secret information to both the client and Serverless applications at compile time. Use this partial static class to set the values of any properties in **ClientSecrets.cs**.

```csharp
namespace ValheimServerGUI.Properties
Expand All @@ -26,16 +26,6 @@ namespace ValheimServerGUI.Properties
}
```

### appsettings.secret.json

Configuration values for the Serverless application, both when running locally and deployed. This file **must** exist when deploying the Serverless application, else it will fail to start.

```jsonc
{
"SteamApiKey": "", // Not yet used, but planned for an upcoming update
}
```

### appsettings.local.json

Configuration values for the Serverless application only when running locally. You can set AWS Lambda environment variables here to imitate running in a cloud environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@ namespace ValheimServerGUI.Properties
/// The values in this class are populated by the static constructor in the corresponding
/// partial class, which is kept out of source control.
/// </summary>
public static partial class Secrets
public static partial class ServerSecrets
{
/// <summary>
/// The HTTP header that will contain the API key for requests made to the Runeberry API.
/// </summary>
public static string RuneberryApiKeyHeader { get; } = string.Empty;

/// <summary>
/// The API key that will be attached to all VSG client requests to the Runeberry API.
/// The Runeberry API keys that will be accepted by the server.
/// </summary>
public static string RuneberryClientApiKey { get; }
public static HashSet<string> RuneberryServerApiKeys { get; } = new();

/// <summary>
/// The Runeberry API keys that will be accepted by the server.
/// API key for interacting with the Steamworks Web API.
/// </summary>
public static HashSet<string> RuneberryServerApiKeys { get; } = new();
public static string SteamApiKey { get; }

/// <summary>
/// API key for interacting with the OpenXBL API.
/// </summary>
public static string XboxApiKey { get; }
}
}
7 changes: 0 additions & 7 deletions ValheimServerGUI.Controls/Controls/LogViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public string LogView

public event EventHandler LogViewChanged;

public string TimestampFormat { get; set; }

public LogViewer()
{
InitializeComponent();
Expand Down Expand Up @@ -87,11 +85,6 @@ private string StoreLog(string message, string viewName)
}
}

if (!string.IsNullOrWhiteSpace(TimestampFormat))
{
message = $"[{DateTime.Now.ToString(TimestampFormat)}] {message}";
}

list.Add(message);

return message;
Expand Down
87 changes: 87 additions & 0 deletions ValheimServerGUI.Controls/Controls/SelectListField.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 64c45f6

Please sign in to comment.