Beispiel #1
0
        private MailConfigInfo GetMailConfigInfo()
        {
            MailConfigInfo mailConfigInfo = new MailConfigInfo();

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

            mailConfigInfo.Driver = (emailDriver != null && emailDriver.Count > 0) ? emailDriver.FirstOrDefault().Value : "log";

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

            mailConfigInfo.Host = (emailHost != null && emailHost.Count > 0) ? emailHost.FirstOrDefault().Value : "smtp.mailtrap.io";

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

            mailConfigInfo.Port = (emailPort != null && emailPort.Count > 0) ? emailPort.FirstOrDefault().Value : "2525";

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

            mailConfigInfo.Username = (emailUsername != null && emailUsername.Count > 0) ? emailUsername.FirstOrDefault().Value : "null";

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

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

            return(mailConfigInfo);
        }
Beispiel #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");
        }
Beispiel #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());
            }
        }