<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NDock.Base;
using NDock.Base.Config;
using NDock.Base.Metadata;
using NDock.Server.Recycle;

namespace NDock.Server.Isolation
{
    public class IsolationAppConst
    {
        public const string WorkingDir = "AppRoot";

        public const string AppConfigFile = "App.config";
    }

    abstract class IsolationApp : MarshalByRefObject, IManagedApp
    {
        private AppServerMetadata m_Metadata;

        protected IManagedAppBase ManagedApp { get; private set; }

        protected IBootstrap Bootstrap { get; private set; }

        protected string StartupConfigFile { get; private set; }

        protected string AppWorkingDir { get; private set; }

        protected IsolationApp(AppServerMetadata metadata, string startupConfigFile)
        {
            State = ServerState.NotInitialized;
            m_Metadata = metadata;
            StartupConfigFile = startupConfigFile;
        }

        public string Name { get; private set; }

        protected string GetAppConfigFile()
        {
            var filePath = Path.Combine(AppWorkingDir, IsolationAppConst.AppConfigFile);

            if (!File.Exists(filePath))
                return string.Empty;

            return filePath;<commit_msg>allowed app's own config file configurable<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NDock.Base;
using NDock.Base.Config;
using NDock.Base.Configuration;
using NDock.Base.Metadata;
using NDock.Server.Recycle;

namespace NDock.Server.Isolation
{
    public class IsolationAppConst
    {
        public const string WorkingDir = "AppRoot";

        public const string AppConfigFile = "App.config";
    }

    abstract class IsolationApp : MarshalByRefObject, IManagedApp
    {
        private AppServerMetadata m_Metadata;

        protected IManagedAppBase ManagedApp { get; private set; }

        protected IBootstrap Bootstrap { get; private set; }

        protected string StartupConfigFile { get; private set; }

        protected string AppWorkingDir { get; private set; }

        protected IsolationApp(AppServerMetadata metadata, string startupConfigFile)
        {
            State = ServerState.NotInitialized;
            m_Metadata = metadata;
            StartupConfigFile = startupConfigFile;
        }

        public string Name { get; private set; }

        protected string GetAppConfigFile()
        {
            var configFile = Config.Options.GetValue("configFile");

            if (string.IsNullOrEmpty(configFile))
                configFile = IsolationAppConst.AppConfigFile;
            else if (Path.IsPathRooted(configFile))
                return configFile;

            configFile = Path.Combine(AppWorkingDir, configFile);

            if (!File.Exists(configFile))
                return string.Empty;

            return configFile;
{'fraction_non_alphanumeric': 0.07173272191287258, 'fraction_numerical': 0.0, 'mean_word_length': 2.683956574185766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5000732', 'n_tokens_mistral': 812, 'n_tokens_neox': 771, 'n_words': 211}