Esempio n. 1
0
        public static string GetPathPrefix(ConfigInfoBase config = null)
        {
            // Get directory and name of the log file

            string prefix = kDefaultPrefix;
            var    app    = ConfigApp._Instance.Value;

            if (config == null)
            {
                config = app.ConfigInfo;
            }

            if (config != null)
            {
                string logDir = config.GetSetting(ConfigInfoBase.kAppsLogFileDir);
                if (!string.IsNullOrWhiteSpace(logDir))
                {
                    prefix = logDir;
                }
                if (!string.IsNullOrWhiteSpace(config.EnvironMode))
                {
                    prefix += config.EnvironMode;
                }
            }

            return(Path.Combine(prefix, app.AppName));
        }
Esempio n. 2
0
        public void SetConfigInfo(ConfigInfoBase cfgInfo, int appId, string appName)
        {
            // Set app global config info.
            // MUST do this when first stating an app.
            // cfgInfo = new ConfigInfoServer()

            ConfigInfo   = cfgInfo;
            AppId        = appId; // What app in the cluster am i ? may be updated later?
            AppTypeId    = appId;
            _AppName     = appName;
            MainThreadId = Environment.CurrentManagedThreadId;
        }
Esempio n. 3
0
        public EmailGatewaySettings(ConfigInfoBase config = null, IValidatorT <string> allowedFilter = null)
        {
            // No need to manually get GetMailSettings MailSettingsSectionGroup in .NET Framework. That is automatic.
            // https://hassantariqblog.wordpress.com/2017/03/20/asp-net-core-sending-email-with-gmail-account-using-asp-net-core-services/

            var app = ConfigApp._Instance.Value;

            if (config == null)
            {
                config = app.ConfigInfo;
            }

            AllowedFilter = config.IsEnvironModeProd() ? null : allowedFilter;     // Can we send email to anybody ? ignore white list in prod mode.

            // Search for email config in AppSettings.json for .NET Core.
            if (config.GetSetting(ConfigInfoBase.kSmtp + "Host") != null)
            {
                Init(config);
            }
        }
Esempio n. 4
0
 public EmailGateway(ConfigInfoBase config, IValidatorT <string> allowedFilter)
 {
     Settings = new EmailGatewaySettings(config, allowedFilter);
 }
Esempio n. 5
0
 public void SetConfigInfo(ConfigInfoBase cfgInfo, Enum appId)
 {
     // Set app global config info.
     SetConfigInfo(cfgInfo, appId.ToInt(), appId.ToDescription());
 }