Skip to content

Commit 539bb6d

Browse files
committed
tweaking with environment and commandline arguments
1 parent eb0a4b5 commit 539bb6d

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.github/workflows/run-demo.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ jobs:
2323
run-id: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}
2424

2525
- name: Run Windows Build
26+
env:
27+
SENTRY_DSN: ${{ secrets.DSN }}
2628
run: |
2729
$exePath = Get-ChildItem -Path "./build" -Filter "SentaurSurvivors-*.exe" -Recurse | Select-Object -First 1
2830
if ($exePath) {
2931
Write-Output "Found executable: $($exePath.FullName)"
3032
$startTime = Get-Date
31-
Write-Output "DSN length: $('${{ secrets.DSN }}'.Length)"
32-
$argumentList = "-dsn","${{ secrets.DSN }}"
33-
Start-Process -FilePath $exePath -ArgumentList $argumentList -Wait -PassThru -NoNewWindow
33+
Start-Process -FilePath $exePath -Wait -PassThru -NoNewWindow
3434
$endTime = Get-Date
3535
$duration = $endTime - $startTime
3636
Write-Output "Game finished in $($duration.ToString('hh\:mm\:ss'))"

Assets/Scripts/Config/SentryCliConfiguration.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ public override void Configure(SentryCliOptions cliOptions)
1313
return;
1414
}
1515

16-
Debug.Log("Getting the 'AUTH TOKEN' from the commandline arguments.");
16+
Debug.Log("Getting the 'AUTH TOKEN' from the commandline arguments.");
17+
1718
var token = ArgumentReader.GetCommandLineArg("auth_token");
1819
if (!string.IsNullOrEmpty(token))
1920
{
20-
Debug.Log("Setting the 'AUTH TOKEN'.");
21+
Debug.Log("Setting the 'AUTH TOKEN' from command line arguments.");
2122
cliOptions.Auth = token;
2223
}
2324
else
2425
{
25-
Debug.LogError("Failed to get the 'AUTH TOKEN'.");
26+
Debug.LogError("Failed to get the 'AUTH TOKEN' from both environment variable and command line arguments.");
2627
}
2728

2829
cliOptions.Organization = "demo";

Assets/Scripts/Config/SentryOptionConfiguration.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,27 @@ public override void Configure(SentryUnityOptions options)
1313
return;
1414
}
1515

16+
Debug.Log("Getting the 'DSN' from the environment.");
17+
18+
var dsn = System.Environment.GetEnvironmentVariable("SENTRY_DSN");
19+
if (!string.IsNullOrEmpty(dsn))
20+
{
21+
Debug.Log("Setting the 'DSN' from environment variable.");
22+
options.Dsn = dsn;
23+
return;
24+
}
25+
1626
Debug.Log("Getting the 'DSN' from the commandline arguments.");
17-
var dsn = ArgumentReader.GetCommandLineArg("dsn");
27+
28+
dsn = ArgumentReader.GetCommandLineArg("dsn");
1829
if (!string.IsNullOrEmpty(dsn))
1930
{
20-
Debug.Log("Setting the 'DSN'.");
31+
Debug.Log("Setting the 'DSN' from command line arguments.");
2132
options.Dsn = dsn;
2233
}
2334
else
2435
{
25-
Debug.LogError("Failed to get the 'DSN'.");
36+
Debug.LogError("Failed to get the 'DSN' from both environment variable and command line arguments.");
2637
}
2738
}
2839
}

0 commit comments

Comments
 (0)