Exemple #1
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");
        }
Exemple #2
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());
            }
        }
Exemple #3
0
        private SessionConfigInfo GetSessionConfigInfo()
        {
            SessionConfigInfo sessionConfigInfo = new SessionConfigInfo();

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

            sessionConfigInfo.Driver = (sessionDriver != null && sessionDriver.Count > 0) ? sessionDriver.FirstOrDefault().Value : "file";

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

            sessionConfigInfo.Lifttime = (sessionLifetime != null && sessionLifetime.Count > 0) ? sessionLifetime.FirstOrDefault().Value : "120";

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

            sessionConfigInfo.ExpireOnClose = (sessionExpireOnClose != null && sessionExpireOnClose.Count > 0) ? sessionExpireOnClose.FirstOrDefault().Value : "false";

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

            sessionConfigInfo.Table = (sessionTable != null && sessionTable.Count > 0) ? sessionTable.FirstOrDefault().Value : "session";

            if (sessionConfigInfo.ExpireOnClose.Equals("expireOnCloseYes"))
            {
                sessionConfigInfo.ExpireOnClose = "true";
            }
            else
            {
                sessionConfigInfo.ExpireOnClose = "false";
            }

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

            sessionConfigInfo.Encrypt = (sessionEncryption != null && sessionEncryption.Count > 0) ? sessionEncryption.FirstOrDefault().Value : "false";

            if (sessionConfigInfo.Encrypt.Equals("expireOnCloseYes"))
            {
                sessionConfigInfo.Encrypt = "true";
            }
            else
            {
                sessionConfigInfo.Encrypt = "false";
            }

            return(sessionConfigInfo);
        }