fixing regex

This commit is contained in:
Andy Pack 2024-09-29 10:12:36 +01:00
parent ef67e17297
commit e13239077a
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7

View File

@ -22,7 +22,7 @@ public partial class SouthernWaterApi
_logger = logger;
}
[GeneratedRegex(@".*const APIURL = '(?<APIURL>.*)'.*\n.*const APIGWKEY = '(?<APIKEY>.*)'.*", RegexOptions.IgnoreCase)]
[GeneratedRegex(@".APIURL=""(?<APIURL>.*)"".*APIGWKEY=""(?<APIKEY>.*?)"".*", RegexOptions.IgnoreCase)]
private static partial Regex ApiUrlAndKey();
public async Task LoadApiUrl()
@ -67,11 +67,13 @@ public partial class SouthernWaterApi
if (apiUrlFound)
{
baseUrl = apiUrl.Value;
_logger.LogInformation("API url found [{APIUrl}]", apiUrl);
}
if (apiKeyFound)
{
this.apiKey = apiKey.Value;
_logger.LogInformation("API key found [{APIKey}]", apiKey);
}
}
catch (HttpRequestException e)