Exemplo n.º 1
0
        private MemCachedConfigInfo GetMemCachedConfigInfo()
        {
            MemCachedConfigInfo memCachedConfigInfo = new MemCachedConfigInfo();

            var memCachedPersistentId = ((IDictionary <string, object>)_context.DynamicContext).ContainsKey("MemCachedPersistentId") ? _context.DynamicContext.MemCachedPersistentId as List <Answer> : new List <Answer>();

            memCachedConfigInfo.PersistenceId = (memCachedPersistentId != null && memCachedPersistentId.Count > 0) ? memCachedPersistentId.FirstOrDefault().Value : "php.app.1000";

            var memCachedHost = ((IDictionary <string, object>)_context.DynamicContext).ContainsKey("MemCachedHost") ? _context.DynamicContext.MemCachedHost as List <Answer> : new List <Answer>();

            memCachedConfigInfo.Host = (memCachedHost != null && memCachedHost.Count > 0) ? memCachedHost.FirstOrDefault().Value : "127.0.0.1";

            var memCachedPort = ((IDictionary <string, object>)_context.DynamicContext).ContainsKey("MemCachedPort") ? _context.DynamicContext.MemCachedPort as List <Answer> : new List <Answer>();

            memCachedConfigInfo.Port = (memCachedPort != null && memCachedPort.Count > 0) ? memCachedPort.FirstOrDefault().Value : "php.app.1000";

            var memCachedUsername = ((IDictionary <string, object>)_context.DynamicContext).ContainsKey("MemCachedUsername") ? _context.DynamicContext.MemCachedUsername as List <Answer> : new List <Answer>();

            memCachedConfigInfo.Username = (memCachedUsername != null && memCachedUsername.Count > 0) ? memCachedUsername.FirstOrDefault().Value : "demouser";

            var memCachedPassword = ((IDictionary <string, object>)_context.DynamicContext).ContainsKey("MemCachedPassword") ? _context.DynamicContext.MemCachedPassword as List <Answer> : new List <Answer>();

            memCachedConfigInfo.Password = (memCachedPassword != null && memCachedPassword.Count > 0) ? memCachedPassword.FirstOrDefault().Value : "password";

            return(memCachedConfigInfo);
        }
Exemplo n.º 2
0
        public EnvTemplate(string applicationId, DatabaseConfigInfo databaseConfigInfo,
                           RedisConfigInfo redisConfigInfo, MailConfigInfo mailConfigInfo,
                           SessionConfigInfo sessionConfigInfo, CockieConfigInfo cockieConfigInfo,
                           MemCachedConfigInfo memCachedConfigInfo) : base(null, applicationId)
        {
            _databaseConfigInfo  = databaseConfigInfo;
            _redisConfigInfo     = redisConfigInfo;
            _mailConfigInfo      = mailConfigInfo;
            _sessionConfigInfo   = sessionConfigInfo;
            _cockieConfigInfo    = cockieConfigInfo;
            _memCachedConfigInfo = memCachedConfigInfo;

            _appKey = System.Guid.NewGuid().ToString("N");
        }
Exemplo n.º 3
0
        private void TransformEnvTemplate(SmartAppInfo smartApp)
        {
            if (smartApp != null)
            {
                DatabaseConfigInfo  databaseConfigInfo  = GetDatabasConfigInfo();
                RedisConfigInfo     redisConfigInfo     = GetRedisConfigInfo();
                MailConfigInfo      mailConfigInfo      = GetMailConfigInfo();
                SessionConfigInfo   sessionConfigInfo   = GetSessionConfigInfo();
                CockieConfigInfo    cockieConfigInfo    = GetCockieConfigInfo();
                MemCachedConfigInfo memCachedConfigInfo = GetMemCachedConfigInfo();

                EnvTemplate envTemplate = new EnvTemplate(smartApp.Id, databaseConfigInfo, redisConfigInfo, mailConfigInfo, sessionConfigInfo, cockieConfigInfo, memCachedConfigInfo);

                _writingService.WriteFile(Path.Combine(_context.BasePath, envTemplate.OutputPath), envTemplate.TransformText());
            }
        }