diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 34fc601..659a017 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -25,3 +25,5 @@ jobs: context: . push: true tags: impworks/bonsai:latest + build-args: | + BUILD_COMMIT=${{ github.sha }} diff --git a/Dockerfile b/Dockerfile index 235d524..dfee112 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,8 @@ RUN ln -s /usr/bin/ffmpeg /app/External/ffmpeg/ffmpeg && \ ln -s /usr/bin/ffprobe /app/External/ffmpeg/ffprobe && \ chmod +x /app/Bonsai +ARG BUILD_COMMIT ENV ASPNETCORE_ENVIRONMENT=Production +ENV BuildCommit=$BUILD_COMMIT EXPOSE 80 ENTRYPOINT ["/app/Bonsai"] diff --git a/src/Bonsai/Areas/Admin/Views/DynamicConfig/Index.cshtml b/src/Bonsai/Areas/Admin/Views/DynamicConfig/Index.cshtml index 0ed1f25..4dcbbf8 100644 --- a/src/Bonsai/Areas/Admin/Views/DynamicConfig/Index.cshtml +++ b/src/Bonsai/Areas/Admin/Views/DynamicConfig/Index.cshtml @@ -1,10 +1,14 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@using Bonsai.Code.Services.Config @using Bonsai.Data.Models -@using Impworks.Utils.Format +@using Impworks.Utils.Strings +@inject BonsaiConfigService ConfigService @model Bonsai.Areas.Admin.ViewModels.DynamicConfig.UpdateDynamicConfigVM @{ ViewBag.Title = "Настройки"; Layout = "~/Areas/Admin/Views/Layout.cshtml"; + + var config = ConfigService.GetStaticConfig(); }

@ViewBag.Title

@@ -84,6 +88,16 @@ + +
+
Версия
+
+ + Сборка: @(StringHelper.Coalesce(config.BuildCommit, "Неизвестно"))
+ База данных: @(config.ConnectionStrings.UseEmbeddedDatabase ? "SQLite" : "PostgreSQL") +
+
+
@if (!ViewData.ModelState.IsValid) { diff --git a/src/Bonsai/Code/Services/Config/StaticConfig.cs b/src/Bonsai/Code/Services/Config/StaticConfig.cs index c98c794..196ae8d 100644 --- a/src/Bonsai/Code/Services/Config/StaticConfig.cs +++ b/src/Bonsai/Code/Services/Config/StaticConfig.cs @@ -10,6 +10,7 @@ public class StaticConfig public WebServerConfig WebServer { get; set; } public DemoModeConfig DemoMode { get; set; } public AuthConfig Auth { get; set; } + public string BuildCommit { get; set; } } ///