mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.4 KiB
71 lines
2.4 KiB
namespace ErsatzTV.Core; |
|
|
|
public class SystemEnvironment |
|
{ |
|
static SystemEnvironment() |
|
{ |
|
BaseUrl = Environment.GetEnvironmentVariable("ETV_BASE_URL"); |
|
|
|
ConfigFolder = Environment.GetEnvironmentVariable("ETV_CONFIG_FOLDER"); |
|
|
|
TranscodeFolder = Environment.GetEnvironmentVariable("ETV_TRANSCODE_FOLDER"); |
|
|
|
string uiPortVariable = Environment.GetEnvironmentVariable("ETV_UI_PORT"); |
|
if (!int.TryParse(uiPortVariable, out int uiPort)) |
|
{ |
|
uiPort = 8409; |
|
} |
|
|
|
UiPort = uiPort; |
|
|
|
string streamingPortVariable = Environment.GetEnvironmentVariable("ETV_STREAMING_PORT"); |
|
if (!int.TryParse(streamingPortVariable, out int streamingPort)) |
|
{ |
|
streamingPort = 8409; |
|
} |
|
|
|
StreamingPort = streamingPort; |
|
|
|
AllowSharedPlexServers = |
|
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("ETV_ALLOW_SHARED_PLEX_SERVERS")); |
|
|
|
string maximumUploadMbVariable = Environment.GetEnvironmentVariable("ETV_MAXIMUM_UPLOAD_MB"); |
|
if (!int.TryParse(maximumUploadMbVariable, out int maximumUploadMb)) |
|
{ |
|
maximumUploadMb = 10; |
|
} |
|
|
|
MaximumUploadMb = maximumUploadMb; |
|
|
|
string slowDbMsVariable = Environment.GetEnvironmentVariable("ETV_SLOW_DB_MS"); |
|
if (int.TryParse(slowDbMsVariable, out int slowDbMs) && slowDbMs > 0) |
|
{ |
|
SlowDbMs = slowDbMs; |
|
} |
|
|
|
string slowApiMsVariable = Environment.GetEnvironmentVariable("ETV_SLOW_API_MS"); |
|
if (int.TryParse(slowApiMsVariable, out int slowApiMs) && slowApiMs > 0) |
|
{ |
|
SlowApiMs = slowApiMs; |
|
} |
|
|
|
string jellyfinPageSizeVariable = Environment.GetEnvironmentVariable("ETV_JF_PAGE_SIZE"); |
|
if (!int.TryParse(jellyfinPageSizeVariable, out int jellyfinPageSize) || jellyfinPageSize <= 0) |
|
{ |
|
jellyfinPageSize = 10; |
|
} |
|
|
|
JellyfinPageSize = jellyfinPageSize; |
|
} |
|
|
|
public static string BaseUrl { get; } |
|
public static string ConfigFolder { get; } |
|
public static string TranscodeFolder { get; } |
|
public static int UiPort { get; } |
|
public static int StreamingPort { get; } |
|
public static bool AllowSharedPlexServers { get; } |
|
public static int MaximumUploadMb { get; } |
|
public static int? SlowDbMs { get; } |
|
public static int? SlowApiMs { get; } |
|
public static int JellyfinPageSize { get; } |
|
}
|
|
|