private static void StartProcesses()
        {
            if (AzureAppServices.Metadata.DebugModeEnabled)
            {
                const string ddLogLevelKey = "DD_LOG_LEVEL";
                if (EnvironmentHelpers.GetEnvironmentVariable(ddLogLevelKey) == null)
                {
                    // This ensures that a single setting from applicationConfig can enable debug logs for every aspect of the extension
                    EnvironmentHelpers.SetEnvironmentVariable(ddLogLevelKey, "debug");
                }
            }

            foreach (var metadata in Processes)
            {
                if (!string.IsNullOrWhiteSpace(metadata.ProcessPath))
                {
                    if (!metadata.IsBeingManaged)
                    {
                        metadata.KeepAliveTask = StartProcessWithKeepAlive(metadata);
                    }
                }
                else
                {
                    Log.Debug("There is no path configured for {ProcessName}.", metadata.Name);
                }
            }
        }
Esempio n. 2
0
        private void LoadAzureCredentials()
        {
            cRndRandom = new Random(System.Environment.TickCount);
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);

            cLisUsers = new List <CreateUserArgs>();
            for (Int32 curUserIndex = 1; curUserIndex <= NOOFUSERS; curUserIndex++)
            {
                String pStrEmail = String.Format("{0}@{1}.com",
                                                 CryptographyHelpers.RandomString(12),
                                                 CryptographyHelpers.RandomString(12));
                String pStrUserName       = CryptographyHelpers.RandomString(12);
                String pStrActivationCode = CryptographyHelpers.RandomString(6);
                cLisUsers.Add(new CreateUserArgs()
                {
                    Email          = pStrEmail,
                    UserName       = pStrUserName,
                    ActivationCode = pStrActivationCode
                });
            }

            for (Int32 curUserIndex = 1; curUserIndex <= NOOFUSERS; curUserIndex++)
            {
                CreateUserArgs pCUAUser = cLisUsers[curUserIndex - 1];
                pCUAUser.Friends = new List <CreateUserArgs>();
                List <Int32> pLisIndexes = new List <Int32>();
                for (Int32 curFriendIndex = 1; curFriendIndex <= NOOFRIENDSPERUSER; curFriendIndex++)
                {
                    List <CreateUserArgs> pLisFriends = new List <CreateUserArgs>();

                    //Get a random user that isn't us
                    Int32 pIntUserIndex = cRndRandom.Next(0, NOOFUSERS);
                    while (pIntUserIndex == curFriendIndex - 1 ||
                           pLisIndexes.Contains(pIntUserIndex))
                    {
                        pIntUserIndex = cRndRandom.Next(0, NOOFUSERS);
                    }

                    pLisIndexes.Add(pIntUserIndex);
                    pCUAUser.Friends.Add(cLisUsers[pIntUserIndex]);
                }
            }
        }
Esempio n. 3
0
        private void LoadAzureCredentials()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrEmail = String.Format("{0}@{1}.com",
                                      CryptographyHelpers.RandomString(12),
                                      CryptographyHelpers.RandomString(12));
            cStrUserName       = CryptographyHelpers.RandomString(12);
            cStrActivationCode = CryptographyHelpers.RandomString(6);
        }
Esempio n. 4
0
        private void LoadAzureCredentials()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrSource = CryptographyHelpers.RandomString(8);

            //Init storage
            cStoStorage = new Storage("TableStorageRootURL",
                                      "AzureWebJobsStorage",
                                      "Test");
        }
Esempio n. 5
0
        public void Init()
        {
            String  pStrCreds = File.ReadAllText("../../../../azure/creds.json");
            JObject pJOtCreds = JObject.Parse(pStrCreds);

            cStrTableStorageRootURL = pJOtCreds["TableStorageRootURL"].Value <String>();
            cStrConnectionString    = pJOtCreds["ConnectionString"].Value <String>();
            EnvironmentHelpers.SetEnvironmentVariable("HOME", @"C:\Temp", EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("TableStorageRootURL", cStrTableStorageRootURL, EnvironmentVariableTarget.Process);
            EnvironmentHelpers.SetEnvironmentVariable("AzureWebJobsStorage", cStrConnectionString, EnvironmentVariableTarget.Process);
            cStrDefaultProfile = File.ReadAllText(@"Assets\ProfileDefaults.json");
            cStrEmail          = String.Format("{0}@{1}.com",
                                               CryptographyHelpers.RandomString(12),
                                               CryptographyHelpers.RandomString(12));
            cStrActivationCode = CryptographyHelpers.RandomString(6);

            //Create the user
            cStoStorage = new Storage("TableStorageRootURL",
                                      "AzureWebJobsStorage",
                                      "Test");
            cUsrUser = new User(GetTestUserPrincipal(), 6);
            cUsrUser.ActivationCode = cStrActivationCode;
            Assert.IsTrue(cUsrUser.Insert(cStoStorage));
        }