Skip to content

Commit

Permalink
feat(ConfigurationWrapper): can decide if to use beta endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuehnel committed Feb 8, 2025
1 parent f4d96c6 commit bef0cb6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions TeslaSolarCharger/Client/Pages/Support.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

<h1>Support</h1>

<MudAlert Severity="Severity.Warning"
NoIcon="true"
ContentAlignment="HorizontalAlignment.Left">
<h5>Never share logs publicly</h5>
Logs might contain sensitive information like your vehicle's location. Do not share logs publicly.
</MudAlert>

<MudLink Href="api/Debug/DownloadLogs">Download Logs</MudLink>

@code {
Expand Down
2 changes: 1 addition & 1 deletion TeslaSolarCharger/Server/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"ShouldUseFakeSolarValues": true,
"IgnoreSslErrors": true,
"BleBaseUrl": "http://raspible:7210/",
//"FleetTelemetryApiUrl": "wss://localhost:7281/ws?",
"UseBetaEndpoints": true,
"GridPriceProvider": {
"EnergyProvider": "Tibber",
"Octopus": {
Expand Down
3 changes: 3 additions & 0 deletions TeslaSolarCharger/Server/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"IgnoreSslErrors": false,
"FleetApiClientId": "f29f71d6285a-4873-8b6b-80f15854892e",
"BackendApiBaseUrl": "https://api.solar4car.com/api/",
"BetaBackendApiBaseUrl": "https://beta.api.solar4car.com/api/",
"UseFleetApiProxy": false,
"LogLocationData": false,
"SendTeslaApiStatsToBackend": true,
Expand All @@ -37,7 +38,9 @@
"BleUsageStopAfterErrorSeconds": 300,
"FleetApiRefreshIntervalSeconds": 500,
"FleetTelemetryApiUrl": "wss://api.fleet-telemetry.solar4car.com/ws?",
"BetaFleetTelemetryApiUrl": "wss://beta.api.fleet-telemetry.solar4car.com/ws?",
"BackendPasswordDefaultLength": 25,
"UseBetaEndpoints": false,
"GridPriceProvider": {
"EnergyProvider": "FixedPrice",
"Octopus": {
Expand Down
10 changes: 10 additions & 0 deletions TeslaSolarCharger/Shared/Wrappers/ConfigurationWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,23 @@ public bool SendTeslaApiStatsToBackend()
public string BackendApiBaseUrl()
{
var environmentVariableName = "BackendApiBaseUrl";
var useBetaEndpoints = configuration.GetValue<bool>("UseBetaEndpoints");
if (useBetaEndpoints)
{
environmentVariableName = "Beta" + environmentVariableName;
}
var value = configuration.GetValue<string>(environmentVariableName);
return value;

Check warning on line 218 in TeslaSolarCharger/Shared/Wrappers/ConfigurationWrapper.cs

View workflow job for this annotation

GitHub Actions / Building TeslaSolarCharger image

Possible null reference return.
}

public string FleetTelemetryApiUrl()
{
var environmentVariableName = "FleetTelemetryApiUrl";
var useBetaEndpoints = configuration.GetValue<bool>("UseBetaEndpoints");
if (useBetaEndpoints)
{
environmentVariableName = "Beta" + environmentVariableName;
}
var value = configuration.GetValue<string>(environmentVariableName);
return value;

Check warning on line 230 in TeslaSolarCharger/Shared/Wrappers/ConfigurationWrapper.cs

View workflow job for this annotation

GitHub Actions / Building TeslaSolarCharger image

Possible null reference return.
}
Expand Down

0 comments on commit bef0cb6

Please sign in to comment.