Add settings.ini

This commit is contained in:
Namhyeon Go 2024-08-13 11:16:27 +09:00
parent 41e542dc7a
commit 92bcb33171
2 changed files with 24 additions and 4 deletions

View File

@ -31,6 +31,7 @@ using System.Runtime.InteropServices;
using MSScriptControl;
using System.IO;
using System.Collections.Generic;
using System.Text;
namespace WelsonJS.Service
{
@ -44,7 +45,7 @@ namespace WelsonJS.Service
private ScriptControl scriptControl;
private readonly string logFilePath = Path.Combine(Path.GetTempPath(), "WelsonJS.Service.Log.txt");
private readonly string appName = "WelsonJS";
private string[] _args;
private string[] args;
private bool disabledScreenTime = false;
private bool disabledFileMonitor = false;
private ScreenMatching screenMatcher;
@ -52,17 +53,25 @@ namespace WelsonJS.Service
[DllImport("user32.dll")]
public static extern int GetSystemMetrics(int nIndex);
public static int SM_REMOTESESSION = 0x1000;
[DllImport("kernel32.dll")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
private static int SM_REMOTESESSION = 0x1000;
public ServiceMain(string[] args)
{
InitializeComponent();
// set service arguments
_args = args;
this.args = args;
// mapping arguments to each variables
var arguments = ParseArguments(_args);
var arguments = ParseArguments(this.args);
foreach (KeyValuePair<string, string> entry in arguments)
{
switch (entry.Key)

11
settings.ini Normal file
View File

@ -0,0 +1,11 @@
[Default]
JSCRIPT_ENV=development ;development or production
CHATGPT_APIKEY=file:data/chatgpt-apikey.txt
NONFREE_STRICT=false ;User consent may be required when using third-party software with an EULA license.
[Service]
DISABLE_SCREEN_TIME=false
DISABLE_FILE_MONITOR=false
ES_HOST=http://localhost:9200
ES_USER=elastic
ES_PASSWORD=changeme