move linux config path to /opt/epson-print-service
This commit is contained in:
@@ -4,7 +4,7 @@ namespace EpsonPrintService;
|
||||
|
||||
public static class ConfigurationPaths
|
||||
{
|
||||
private const string LinuxConfigDir = "/root/epsonprintservice";
|
||||
private const string LinuxConfigDir = "/opt/epson-print-service";
|
||||
private const string LocalConfigFileName = "config.txt";
|
||||
|
||||
public static string GetConfigPath()
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using EpsonPrintService;
|
||||
|
||||
namespace Inspectron.Epson.Tests.Configuration;
|
||||
|
||||
public class ConfigurationPathsTests
|
||||
{
|
||||
[Fact]
|
||||
public void GetConfigPath_uses_opt_dir_on_linux_when_env_unset_and_no_local_file()
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return;
|
||||
var previous = Environment.GetEnvironmentVariable("EPSON_CONFIG_PATH");
|
||||
Environment.SetEnvironmentVariable("EPSON_CONFIG_PATH", null);
|
||||
try
|
||||
{
|
||||
var path = ConfigurationPaths.GetConfigPath();
|
||||
Assert.Equal("/opt/epson-print-service/config.txt", path);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("EPSON_CONFIG_PATH", previous);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EPSON_CONFIG_PATH_override_still_wins()
|
||||
{
|
||||
var previous = Environment.GetEnvironmentVariable("EPSON_CONFIG_PATH");
|
||||
Environment.SetEnvironmentVariable("EPSON_CONFIG_PATH", "/tmp/override.txt");
|
||||
try
|
||||
{
|
||||
var path = ConfigurationPaths.GetConfigPath();
|
||||
Assert.Equal("/tmp/override.txt", path);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("EPSON_CONFIG_PATH", previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user