示例#1
0
 public ConfigurationSevice(
     IConfiguration appConfig,
     ILogger <ConfigurationSevice> logger,
     IMapper mapper,
     RomiSettings settings,
     IExternalTimeZoneProvider tzProvider)
 {
     this._logger     = logger;
     this._mapper     = mapper;
     this.Settings    = this._mapper.Map <HostSettings>(settings);
     this.AppConfig   = appConfig;
     this._tzProvider = tzProvider;
 }
示例#2
0
        public HostSettings(RomiSettings settings)
            : this()
        {
            if (settings != null)
            {
                ServicePort     = settings.ServicePort > 0 ? settings.ServicePort : 1865;
                ApiRoot         = settings.ApiRoot ?? ApiRoot;
                ApiVersion      = settings.ApiVersion ?? ApiVersion;
                ApplicationPath = settings.ApplicationPath ?? ApplicationPath;
                LogPath         = settings.LogPath ?? LogPath;
                DataPath        = settings.DataPath ?? DataPath;
            }

            if (!Path.IsPathRooted(LogPath))
            {
                LogPath = $"{ApplicationPath}/{LogPath}";
            }

            if (!Path.IsPathRooted(DataPath))
            {
                DataPath = $"{ApplicationPath}/{DataPath}";
            }
        }