You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Horde: Add explicit directories for storing logs and artifacts, and default to C:\ProgramData on Windows.
[CL 16551881 by Ben Marsh in ue5-main branch]
This commit is contained in:
@@ -188,6 +188,23 @@ namespace HordeServer
|
||||
return new X509Certificate2(FileReference.ReadAllBytes(FileReference.Combine(AppDir, HordeSettings.ServerPrivateCert)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default directory for storing application data
|
||||
/// </summary>
|
||||
/// <returns>The default data directory</returns>
|
||||
public static DirectoryReference GetDefaultDataDir()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
DirectoryReference? Dir = DirectoryReference.GetSpecialFolder(Environment.SpecialFolder.CommonApplicationData);
|
||||
if (Dir != null)
|
||||
{
|
||||
return DirectoryReference.Combine(Dir, "Horde");
|
||||
}
|
||||
}
|
||||
return DirectoryReference.Combine(AppDir, "Data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using EpicGames.Core;
|
||||
using HordeServer.Services;
|
||||
using HordeServer.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using TimeZoneConverter;
|
||||
|
||||
@@ -100,14 +102,12 @@ namespace HordeServer
|
||||
/// <summary>
|
||||
/// MongoDB connection string
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string DatabaseConnectionString { get; set; } = null!;
|
||||
public string? DatabaseConnectionString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MongoDB database name
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string DatabaseName { get; set; } = null!;
|
||||
public string DatabaseName { get; set; } = "Horde";
|
||||
|
||||
/// <summary>
|
||||
/// The claim type for administrators
|
||||
@@ -226,9 +226,24 @@ namespace HordeServer
|
||||
public StorageProviderType ExternalStorageProviderType { get; set; } = StorageProviderType.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// local log file storage directory, if using type filesystem
|
||||
/// Local log/artifact storage directory, if using type filesystem
|
||||
/// </summary>
|
||||
public string LocalStorageDir { get; set; } = "D:\\HordeLogs";
|
||||
public string LocalLogsDir { get; set; } = "Logs";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full path referred to by LocalStorageDir
|
||||
/// </summary>
|
||||
public DirectoryReference LocalLogsDirRef => DirectoryReference.Combine(Program.GetDefaultDataDir(), LocalLogsDir);
|
||||
|
||||
/// <summary>
|
||||
/// Local artifact storage directory, if using type filesystem
|
||||
/// </summary>
|
||||
public string LocalArtifactsDir { get; set; } = "Artifacts";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the full path referred to by LocalStorageDir
|
||||
/// </summary>
|
||||
public DirectoryReference LocalArtifactsDirRef => DirectoryReference.Combine(Program.GetDefaultDataDir(), LocalArtifactsDir);
|
||||
|
||||
/// <summary>
|
||||
/// S3 bucket region for logfile storage
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace HordeServer.Services
|
||||
public FSExternalArtifactStorage(ServerSettings CurrentSettings, ILogger<ArtifactService> Logger)
|
||||
{
|
||||
this.Logger = Logger;
|
||||
this.BaseDir = new DirectoryInfo(CurrentSettings.LocalStorageDir);
|
||||
this.BaseDir = new DirectoryInfo(CurrentSettings.LocalArtifactsDirRef.FullName);
|
||||
|
||||
Directory.CreateDirectory(this.BaseDir.FullName);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace HordeServer.Storage.Impl
|
||||
public FileSystemStorageBackend(IOptionsMonitor<ServerSettings> Settings)
|
||||
{
|
||||
ServerSettings CurrentSettings = Settings.CurrentValue;
|
||||
BaseDir = new DirectoryReference(CurrentSettings.LocalStorageDir);
|
||||
BaseDir = CurrentSettings.LocalLogsDirRef;
|
||||
DirectoryReference.CreateDirectory(BaseDir);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user