Ejemplo n.º 1
7
 public ActionResult EditEnvironment(string id, string name, EnvironmentConfig model)
 {
     var item = GetConfigurationReader().GetConfiguration(id);
     var env = (from e in item.Environments where e.EnvironmentName == name select e).First();
     env.EnvironmentName = model.EnvironmentName;
     if (env.Parameters == null)
         env.Parameters = new List<ConfigParameter>();
     var keyName = Request.Form["keyName"];
     var value = Request.Form["keyValue"];
     if (keyName.ContainsCharacters())
     {
         var param = (from p in env.Parameters where p.Name == keyName select p).FirstOrDefault();
         if (param.IsNull())
         {
             param = new ConfigParameter();
             env.Parameters.Add(param);
         }
         param.Name = keyName;
         if (keyName.ToLower().Contains("password"))
         {
             param.Value = value.Encrypt("mayTheKeysSupportAllMyValues");
             param.BinaryValue = param.Value.GetByteArray();
             if(param.Value.Decrypt("mayTheKeysSupportAllMyValues")!=value) throw new StardustCoreException("Encryption validation failed!");
         }
         else
             param.Value = value;
     }
     GetConfigurationReader().WriteConfigurationSet(item, id);
     ViewBag.Id = id;
     return RedirectToAction("EditEnvironment", new { id = id });
 }
Ejemplo n.º 2
2
 private RunContext(ApplicationContext applicationContext, string action, ReleasesConfig releasesConfig, FeatureConfigCollection featuresConfig, TaskDefinitionConfigCollection taskDefinitionsConfig, TaskManager taskManager, ReleaseConfig activeRelease, EnvironmentConfig activeEnvironment, bool dryRun)
 {
     mApplicationContext = applicationContext;
     mAction = action;
     mReleasesConfig = releasesConfig;
     mFeaturesConfig = featuresConfig;
     mTaskDefinitionsConfig = taskDefinitionsConfig;
     mTaskManager = taskManager;
     mActiveRelease = activeRelease;
     mActiveEnvironment = activeEnvironment;
     mDryRun = dryRun;
 }
Ejemplo n.º 3
0
 public ActionResult CreateEnvironment(string id, EnvironmentConfig model)
 {
     var item = GetConfigurationReader().GetConfiguration(id);
     item.Environments.Add(model);
     GetConfigurationReader().WriteConfigurationSet(item, id);
     return RedirectToAction("Index", new { id = id });
 }
Ejemplo n.º 4
0
        public ActionResult CreateEnvironment(string id, EnvironmentConfig model)
        {
            var item = GetConfigurationReader().GetConfiguration(id);

            item.Environments.Add(model);
            GetConfigurationReader().WriteConfigurationSet(item, id);
            return(RedirectToAction("Index", new { id = id }));
        }
 public bool HasKey(EnvironmentConfig config, string key)
 {
     if (enviromentMap.TryGetValue(config, out var map))
     {
         return(map.ContainsKey(key));
     }
     return(false);
 }
 public WebDriverSetup(ScenarioContext context)
 {
     DriverPath       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     _context         = context;
     _objectContext   = context.Get <ObjectContext>();
     _frameworkConfig = context.Get <FrameworkConfig>();
     _executionConfig = context.Get <EnvironmentConfig>();
 }
 public void SetKey(EnvironmentConfig config, string key, object value)
 {
     value = null;
     if (enviromentMap.TryGetValue(config, out var map))
     {
         map.TryGetValue(key, out value);
     }
 }
Ejemplo n.º 8
0
 public SimulationConfig(EnvironmentConfig environmentConfig, PubSubConfig pubSubConfig, EngineConfig engineConfig,
                         int ticksToSimulate)
 {
     EnvironmentConfig = environmentConfig;
     PubSubConfig      = pubSubConfig;
     EngineConfig      = engineConfig;
     TicksToSimulate   = ticksToSimulate;
     _agentConfigs     = new Dictionary <Type, AgentConfig <IAgent> >();
 }
 public EmailsService(Context ffsaDbContext, DbContextOptions <Context> options, IOptions <EnvironmentConfig> environmentConfig, ICipherService cipherService, IEmailHelper emailhelper, IEmailsValidation emailsValidation)
 {
     _ffsaDbContext     = ffsaDbContext;
     _environmentConfig = environmentConfig.Value;
     _cipherService     = cipherService;
     _emailhelper       = emailhelper;
     _smtpClient        = emailhelper.smtpClient();
     _emailsValidation  = emailsValidation;
 }
        public void EmptyKey(EnvironmentConfig config, string key)
        {
            IDictionary <string, object> map;

            if (enviromentMap.TryGetValue(config, out map))
            {
                map.Remove(key);
            }
        }
Ejemplo n.º 11
0
        private BrowserFactory(Dictionary <string, string> initConfig, EnvironmentConfig envConfig)
        {
            Console.WriteLine("Inside BrowserFactory");
            this.initConfig  = initConfig;
            this.envConfig   = envConfig;
            this.BrowserName = initConfig.GetValueOrDefault("webbrowser");

            //TODO: we need this in order to close browsers, but there has to be a better way
        }
        public void UnSet(EnvironmentConfig config, string key)
        {
            object value = null;

            if (enviromentMap.TryGetValue(config, out var map))
            {
                map.TryGetValue(key, out value);
            }
            value = null;
        }
        public bool IsSetNotEmpty(EnvironmentConfig config, string key)
        {
            object value = null;

            if (enviromentMap.TryGetValue(config, out var map))
            {
                map.TryGetValue(key, out value);
            }
            return(value != null);
        }
        public static Uri RescanUrl(EnvironmentConfig environmentConfig, string project, string scope)
        {
            if (environmentConfig == null)
            {
                throw new ArgumentNullException(nameof(environmentConfig));
            }

            return(new Uri($"https://{environmentConfig.FunctionAppHostname}/api/scan/{environmentConfig.Organization}/" +
                           $"{project}/{scope}"));
        }
        public bool HasKey(EnvironmentConfig config, string key)
        {
            IDictionary <string, object> map;

            if (enviromentMap.TryGetValue(config, out map))
            {
                return(map.ContainsKey(key));
            }
            return(false);
        }
        public void SetKey(EnvironmentConfig config, string key, object value)
        {
            IDictionary <string, object> map;

            value = null;
            if (enviromentMap.TryGetValue(config, out map))
            {
                map.TryGetValue(key, out value);
            }
        }
    public static IPromise <EnvironmentConfig> InitEnvironmentConfig()
    {
        IPromise <EnvironmentConfig> p = ResourceLoaderPromise.Load <EnvironmentConfig>(ENVIRONMENT_CONFIG_PATH, Context.OutOfDungeon, ResourceLoadMode.Instantly);

        p.Then(config =>
        {
            EnvironmentConfig = config;
            EnvironmentConfig.Deserialize();
        });
        return(p);
    }
        public bool IsSetNotZero(EnvironmentConfig config, string key)
        {
            object value = null;
            int    res;

            if (enviromentMap.TryGetValue(config, out var map))
            {
                map.TryGetValue(key, out value);
            }
            Int32.TryParse(value as string, out res);
            return(res != 0);
        }
Ejemplo n.º 19
0
        public DataService(EnvironmentConfig enviConfig, LotInfo LotInfo, Recipe Recipe = null, string subcon = "")
        {
            lotInfo         = LotInfo;
            lotInfo.SETUP_T = DateTime.Now;
            lotInfo.START_T = DateTime.Now;
            transferMode    = enviConfig.TransferMode;

            ftpUpload = new FtpWeb(enviConfig.ServerDataIP.IP, string.Empty, enviConfig.ServerDataIP.User, enviConfig.ServerDataIP.Password);

            if (subcon == "JCET" && Recipe != null)
            {
                string tc             = ConvertTestCode(lotInfo.TestCode.ToString(), Recipe.TestCodeConvertConfiguration.dictTestCode);
                string prefixDir      = ApplyNameRule(Recipe.DatalogConfiguration.datalog_name_rule_1, subcon, tc);
                string prefixDirLocal = enviConfig.LocalDlogDir + prefixDir;
                string csvDirLocal    = prefixDirLocal + "\\csvdir\\";
                CreateLocalDir(csvDirLocal);
                string singlefileDirLocal = prefixDirLocal + "\\SingleFile\\";
                CreateLocalDir(singlefileDirLocal);
                string fulllotfileDirLocal = prefixDirLocal + "\\FullLotFile\\";
                CreateLocalDir(fulllotfileDirLocal);
                string stdtxtDirLocal = prefixDirLocal + "\\STD_TXT\\";
                CreateLocalDir(stdtxtDirLocal);

                CreateServerDir(enviConfig.ServerDlogDir, prefixDir);

                string logname = ApplyNameRule(Recipe.DatalogConfiguration.datalog_name_rule_2, subcon, tc);
                stdfPath   = singlefileDirLocal + logname + ".stdf";
                csvPath    = csvDirLocal + logname + ".csv";
                configPath = csvDirLocal + lotInfo.ModeCode.ToString() + "_" + lotInfo.TesterID.ToString() + "_config.txt";
                htmlPath   = fulllotfileDirLocal + logname + "_" + lotInfo.ModeCode.ToString() + ".html";
                csvsumPath = fulllotfileDirLocal + logname + "_" + lotInfo.ModeCode.ToString() + ".csv";
                mtcsvPath  = singlefileDirLocal + logname + ".csv";
            }
            else
            {
                string dirLocal = Path.Combine(enviConfig.LocalDlogDir, lotInfo.ProgramName.ToString());
                CreateLocalDir(dirLocal);
                string dirLocalFullLot = Path.Combine(dirLocal, "FullLot");
                CreateLocalDir(dirLocalFullLot);

                string logname     = lotInfo.ProgramName.ToString() + "_" + lotInfo.SubLotNo.ToString() + "_" + lotInfo.TestCode.ToString() + "_" + string.Format("{0:yyyyMMddHHmmss}", lotInfo.START_T);
                string logname_sum = lotInfo.ProgramName.ToString() + "_" + lotInfo.SubLotNo.ToString() + "_" + lotInfo.TestCode.ToString() + "_SUM_" + string.Format("{0:yyyyMMddHHmmss}", lotInfo.START_T);
                stdfPath   = Path.Combine(dirLocal, logname + ".stdf");
                mtcsvPath  = Path.Combine(dirLocal, logname + ".csv");
                csvPath    = Path.Combine(dirLocal, logname_sum + ".csv");
                configPath = Path.Combine(dirLocal, lotInfo.TesterID.ToString() + "_sum_history.txt");
                htmlPath   = Path.Combine(dirLocalFullLot, logname + ".html");
                csvsumPath = Path.Combine(dirLocalFullLot, logname + ".csv");
            }

            stdfService = new STDFService(stdfPath);
        }
Ejemplo n.º 20
0
        public static void Main(string[] args)
        {
            try
            {
                EnvironmentConfig.Initialize();

                TelemetryConfiguration telemetryConfig = new TelemetryConfiguration(
                    EnvironmentConfig.Singleton.AppInsightsInstrumentationKey);
                TelemetryHelper.Initilize(telemetryConfig, SourceName);
            }
            catch (Exception error)
            {
                Console.WriteLine(
                    "UNHANDLED EXCEPTION during initialization before TelemetryClient oculd be created: {0}",
                    error);

                throw;
            }

            try
            {
                _ = EnvironmentConfig.Singleton.TenantId;
                _ = EnvironmentConfig.Singleton.AllowedUsers;

                KeyVaultHelper.Initialize(new Uri(EnvironmentConfig.Singleton.KeyVaultUri), new DefaultAzureCredential());

                using (CosmosClient client =
                           KeyVaultHelper.Singleton.CreateCosmosClientFromKeyVault(
                               EnvironmentConfig.Singleton.MigrationMetadataCosmosAccountName,
                               WebAppUserAgentPrefix,
                               useBulk: false,
                               retryOn429Forever: true))
                {
                    MigrationConfigDal.Initialize(
                        client.GetContainer(
                            EnvironmentConfig.Singleton.MigrationMetadataDatabaseName,
                            EnvironmentConfig.Singleton.MigrationMetadataContainerName),
                        EnvironmentConfig.Singleton.DefaultSourceAccount,
                        EnvironmentConfig.Singleton.DefaultDestinationAccount);

                    CreateHostBuilder(args).Build().Run();
                }
            }
            catch (Exception unhandledException)
            {
                TelemetryHelper.Singleton.LogError(
                    "UNHANDLED EXCEPTION: {0}",
                    unhandledException);

                throw;
            }
        }
Ejemplo n.º 21
0
        private async Task <ClaimsIdentity> RunTestCase(IConfigurationRetriever <IDictionary <string, HashSet <string> > > configRetriever, string[] requiredEndorsements = null)
        {
            var tokenExtractor = new JwtTokenExtractor(
                emptyClient,
                EmulatorValidation.ToBotFromEmulatorTokenValidationParameters,
                AuthenticationConstants.ToBotFromEmulatorOpenIdMetadataUrl,
                AuthenticationConstants.AllowedSigningAlgorithms,
                new ConfigurationManager <IDictionary <string, HashSet <string> > >("http://test", configRetriever));

            string header = $"Bearer {await new MicrosoftAppCredentials(EnvironmentConfig.TestAppId(), EnvironmentConfig.TestAppPassword()).GetTokenAsync()}";

            return(await tokenExtractor.GetIdentityAsync(header, "testChannel", requiredEndorsements));
        }
Ejemplo n.º 22
0
    private void PreBuildConfiguration(EnvironmentConfig config)
    {
        // seed
        Random.InitState(config.seed);

        // movement
        Character.characterSpeed = config.agent_speed;
        Character.jumpForce      = config.jump_force;
        Character.viewDistance   = config.view_distance;
        NPC.walkingSpeed         = config.npc_speed;

        FireHazard.SPREAD_SPEED = config.fire_spread;
    }
Ejemplo n.º 23
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------

        public MicroserviceController(
            RunMode runMode,
            string microservicePath,
            MicroserviceConfig microserviceConfig,
            EnvironmentConfig environmentConfig,
            string cliDirectory = null)
        {
            _runMode            = runMode;
            _microservicePath   = microservicePath;
            _microserviceConfig = microserviceConfig;
            _environmentConfig  = environmentConfig;
            _cliDirectory       = cliDirectory;
            _exceptions         = ImmutableList <Exception> .Empty;
        }
Ejemplo n.º 24
0
 public S3StaticWebsiteService(IAmazonS3 amazonS3,
                               IAmazonCloudFront cloudFrontService,
                               ILogger <S3StaticWebsiteService> logger,
                               AWSConfig awsConfig,
                               EnvironmentConfig environmentConfig,
                               CloudFrontConfig cloudFrontConfig)
 {
     _amazonS3          = amazonS3;
     _logger            = logger;
     _awsConfig         = awsConfig;
     _cloudFrontService = cloudFrontService;
     _environmentConfig = environmentConfig;
     _cloudFrontConfig  = cloudFrontConfig;
 }
Ejemplo n.º 25
0
 static void Main(string[] args)
 {
     if (args.Length != 0)
     {
         var targetEnv = args[0];
         System.Console.WriteLine($"Updating hostconfig with '{targetEnv}' environment info");
         var environment = new EnvironmentConfig();
         var result      = environment.SetEnvironment(targetEnv);
         System.Console.WriteLine($"Result {result}");
     }
     else
     {
         System.Console.WriteLine("No environment has been specified!");
     }
 }
Ejemplo n.º 26
0
        public UIService()
        {
            try
            {
                enviConfig = GetEnviConfig();
            }
            catch
            {
                throw new FileLoadException(string.Format("Invalid environment config file '{0}', please contact the developer!", FileStructure.ENVIRONMENT_CONFIG_FILE_PATH));
            }
            uiLogPath = Path.Combine(enviConfig.ProductionWorkspace, "UILog", string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + ".log");
            CreateDir(Path.GetDirectoryName(uiLogPath));

            ftpDownload = new FtpWeb(enviConfig.ServerProgIP.IP, string.Empty, enviConfig.ServerProgIP.User, enviConfig.ServerProgIP.Password);
        }
        public bool IsSet(EnvironmentConfig config, string key)
        {
            object value = null;

            if (enviromentMap.TryGetValue(config, out var map))
            {
                map.TryGetValue(key, out value);
            }
            if (value != null)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 28
0
 public Repository(EnvironmentConfig configuration, ILogger logger)
 {
     _configuration = configuration;
     _logger        = logger;
     if (_configuration.COUCHDB_URL != null)
     {
         string url = "http://" + _configuration.COUCHDB_URL + ":" + _configuration.COUCHDB_PORT;
         this.ConnectionDB = new CouchClient(url,
                                             s => s.UseBasicAuthentication(_configuration.COUCHDB_USER, _configuration.COUCHDB_PASSWORD));
     }
     else
     {
         this.ConnectionDB = new CouchClient("http://" + Startup.StaticConfig["DBconnection:url"] + ":" + Startup.StaticConfig["DBconnection:port"],
                                             s => s.UseBasicAuthentication(Startup.StaticConfig["DBconnection:user"], Startup.StaticConfig["DBconnection:password"]));
     }
     _logger.LogInformation(String.Format("DB at: {0}.", this.ConnectionDB.ConnectionString));
 }
Ejemplo n.º 29
0
        private void AddInMemorySettings(EnvironmentConfig config)
        {
            var builder = new ConfigurationBuilder();

            var dict = new Dictionary <string, string>
            {
                { "App:MainWindow:Height", "20" },
                { "App:MainWindow:Width", "50" },
                { "App:MainWindows:ValidatedValue", "3" },
                { "App:MainWindow:Dialog:Colors:Frame", "RED" },
                { "App:MainWindow:Dialog:Colors:Title", "DARK_RED" }
            };

            builder.AddInMemoryCollection(dict);

            config.UseConfiguration(builder.Build());
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            var smartHub = new SmartHub
            {
                Environment   = EnvironmentConfig.Load(),
                LightAdapters = new List <ILightAdapter>
                {
                    new HueLightAdapter()
                },
                SensorAdapters = new List <ISensorAdapter>
                {
                    new HueSensorAdapater()
                }
            };

            HomeLogger.WriteLine("Loading rules");

            string path = "rules.json";

            if (!File.Exists(path))
            {
                path = "../../../../config/rules.json";

                if (!File.Exists(path))
                {
                    throw new Exception("Could not find rules!");
                }
            }

            var rules = JsonConvert.DeserializeObject <Rule[]>(File.ReadAllText(path));

            HomeLogger.WriteLine("Initializing smarthub");

            smartHub.Initialize();

            HomeLogger.WriteLine("Starting rule engine loop");

            var ruleProcessor = new RuleProcessor(rules, smartHub);

            ruleProcessor.Run();

            Console.ReadLine();

            ruleProcessor.Stop();
        }
Ejemplo n.º 31
0
        static void Main(string[] args)
        {
            var smartHub = new SmartHub
            {
                Environment   = EnvironmentConfig.Load(),
                LightAdapters = new List <ILightAdapter>
                {
                    new HueLightAdapter()
                },
                SensorAdapters = new List <ISensorAdapter>
                {
                    new HueSensorAdapater()
                }
            };

            smartHub.Initialize();

            IList <ISmartLight> lights = smartHub.PollLights();

            IList <ISmartSensor> sensors = smartHub.PollSensors();

            foreach (ISmartLight light in lights)
            {
                light.State.On         = false;
                light.State.Brightness = 199;

                smartHub.UpdateLight(light);
            }

            Thread.Sleep(5000);

            var lightState = new LightState
            {
                On         = true,
                Brightness = 255,
                Saturation = 255,
                Hue        = 0
            };

            smartHub.UpdateLightsInRooms(new [] { smartHub.Environment.Rooms[0].Id }, lightState);

            System.Console.ReadLine();
        }
        private static IHost CreateWebJobsHost <T>(string path)
            where T : FunctionsStartup, new()
        {
            string contentRoot = GetProjectPath(path, typeof(T));

            return(new HostBuilder()
                   .UseContentRoot(contentRoot)
                   .ConfigureLogging(b => b.AddConsole())
                   .ConfigureAppConfiguration(b => b
                                              .Add(AzureFunctionsConfiguration.CreateRoot())
                                              .Add(new HostJsonFileConfigurationSource(contentRoot))
                                              .Add(EnvironmentConfig.FromLocalSettings(contentRoot)))
                   .ConfigureWebJobs((c, b) => b
                                     .UseWebJobsStartup(typeof(T), new WebJobsBuilderContext {
                Configuration = c.Configuration
            }, NullLoggerFactory.Instance)
                                     .AddDurableTask())
                   .Build());
        }
Ejemplo n.º 33
0
        private void Main_Load(object sender, EventArgs e)
        {
            Hide();
            notifyIcon.Visible = true;


            _hidden = true;

            environment = new EnvironmentConfig();
            foreach (var env in environment.Environments)
            {
                var toolStrip = new ToolStripMenuItem
                {
                    Name = env.Hostname,
                    Text = env.Hostname
                };
                toolStrip.Click += ToolStrip_Click;
                contextMenuStrip.Items.Add(toolStrip);
            }
        }