예제 #1
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());
            }
        }
예제 #2
0
        private RedisConfigInfo GetRedisConfigInfo()
        {
            RedisConfigInfo redisConfigInfo = new RedisConfigInfo();

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

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

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

            redisConfigInfo.Port = (redistPort != null && redistPort.Count > 0) ? redistPort.FirstOrDefault().Value : "6379";


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

            redisConfigInfo.Password = (redisPassword != null && redisPassword.Count > 0) ? redisPassword.FirstOrDefault().Value : "null";

            return(redisConfigInfo);
        }