Add --user-variables-file parameter when starting a service

This commit is contained in:
Namhyeon Go 2024-10-03 22:56:04 +09:00
parent c157116680
commit 86916d2ed9
2 changed files with 22 additions and 4 deletions

View File

@ -34,6 +34,7 @@ using System.Collections.Generic;
using WelsonJS.TinyINIController;
using System.Collections;
using System.Threading.Tasks;
using System.Linq;
namespace WelsonJS.Service
{
@ -256,15 +257,27 @@ namespace WelsonJS.Service
// make the start arguments
string[] startArguments;
string[] _args;
if (Environment.UserInteractive)
{
startArguments = new string[args.Length + 1];
args.CopyTo(startArguments, 0);
startArguments[args.Length] = "--user-interactive";
_args = new string[]
{
$"--user-variables-file={userVariablesHandler.GetEnvFilePath()}",
"--user-interactive"
};
}
else
{
startArguments = args;
_args = new string[]
{
$"--user-variables-file={userVariablesHandler.GetEnvFilePath()}"
};
}
startArguments = new string[args.Length + _args.Length];
args.CopyTo(startArguments, 0);
for (int i = 0; i < _args.Length; i++)
{
startArguments[args.Length + i] = _args[i];
}
// initialize

View File

@ -72,5 +72,10 @@ namespace WelsonJS.Service
userVariables.TryGetValue(name, out string value);
return value;
}
public string GetEnvFilePath()
{
return envFilePath;
}
}
}