Exemplo n.º 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");
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 3
0
        private CockieConfigInfo GetCockieConfigInfo()
        {
            CockieConfigInfo cockieConfigInfo = new CockieConfigInfo();

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

            cockieConfigInfo.Name = (sessionCookieName != null && sessionCookieName.Count > 0) ? sessionCookieName.FirstOrDefault().Value : "php.app";

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

            cockieConfigInfo.Path = (sessionCookiePath != null && sessionCookiePath.Count > 0) ? sessionCookiePath.FirstOrDefault().Value : "/";

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

            cockieConfigInfo.Domain = (sessionCookieDomainName != null && sessionCookieDomainName.Count > 0) ? sessionCookieDomainName.FirstOrDefault().Value : "app.domain.com";

            return(cockieConfigInfo);
        }