Skip to content

Commit

Permalink
Show S3 status even if orcasite doesn't know about the node
Browse files Browse the repository at this point in the history
Fixes #134

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Oct 9, 2024
1 parent 92ae753 commit 09d1ab5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions OrcanodeMonitor/Core/Fetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class Fetcher
private static string _orcaHelloHydrophonesUrl = "https://aifororcasdetections2.azurewebsites.net/api/hydrophones";
private static DateTime _unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
private static string _iftttServiceKey = Environment.GetEnvironmentVariable("IFTTT_SERVICE_KEY") ?? "<unknown>";
private static string _defaultS3Bucket = "streaming-orcasound-net";
private static string _defaultProdS3Bucket = "audio-orcasound-net";
private static string _defaultDevS3Bucket = "dev-streaming-orcasound-net";
public static string IftttServiceKey => _iftttServiceKey;

/// <summary>
Expand Down Expand Up @@ -365,12 +366,12 @@ public async static Task UpdateDataplicityDataAsync(OrcanodeMonitorContext conte
string dataplicityName = name.ToString();
node.DataplicityName = dataplicityName;

if (node.S3Bucket.IsNullOrEmpty())
if (node.S3Bucket.IsNullOrEmpty() || (node.OrcasoundStatus == OrcanodeOnlineStatus.Absent))
{
node.S3Bucket = _defaultS3Bucket;
node.S3Bucket = dataplicityName.ToLower().StartsWith("dev") ? _defaultDevS3Bucket : _defaultProdS3Bucket;
}

if (node.S3NodeName.IsNullOrEmpty())
if (node.S3NodeName.IsNullOrEmpty() || (node.OrcasoundStatus == OrcanodeOnlineStatus.Absent))
{
// Fill in a non-authoritative default S3 node name.
// Orcasound is authoritative here since our default is
Expand Down

0 comments on commit 09d1ab5

Please sign in to comment.