blob: d42b117d6b54ecc1113b0eec5cfe6ac58f380846 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
namespace IOL.BookmarkThing.Server.Utilities;
public static class ConfigurationExtensions
{
/// <summary>
/// Get the contents of AppData/version.txt.
/// </summary>
/// <param name="configuration"></param>
/// <returns></returns>
public static string GetVersion(this IConfiguration configuration) {
var versionFilePath = Path.Combine(AppPaths.AppData.HostPath, "version.txt");
if (File.Exists(versionFilePath)) {
var versionText = File.ReadAllText(versionFilePath);
return versionText + "-" + configuration.GetValue<string>("ASPNETCORE_ENVIRONMENT");
}
return "unknown-" + configuration.GetValue<string>("ASPNETCORE_ENVIRONMENT");
}
}
|