Ejemplo n.º 1
0
        /// <summary>
        ///  Get the media rewrite folder
        /// </summary>
        /// <remarks>
        ///     looks in appSettings for uSync:mediaFolder
        ///
        ///  <add key="uSync.mediaFolder" value="/something" />
        ///
        ///  or in uSync8.config for media setting
        ///
        ///  <backoffice>
        ///     <media>
        ///         <folder>/somefolder</folder>
        ///     </media>
        ///  </backoffice>
        /// </remarks>
        private string GetMediaFolderSetting(uSyncConfig config)
        {
            // look in the web.config
            var folder = ConfigurationManager.AppSettings["uSync.mediaFolder"];

            if (!string.IsNullOrWhiteSpace(folder))
            {
                return(folder);
            }

            // azure guessing - so for most people seeing this issue,
            // they won't have to do any config, as we will detect it ???
            var useDefault = ConfigurationManager.AppSettings["AzureBlobFileSystem.UseDefaultRoute:media"];

            if (useDefault != null && bool.TryParse(useDefault, out bool usingDefaultRoute) && !usingDefaultRoute)
            {
                // means azure is configured to not use the default root, so the media
                // will be prepended with /container-name.
                var containerName = ConfigurationManager.AppSettings["AzureBlobFileSystem.ContainerName:media"];
                if (!string.IsNullOrWhiteSpace(containerName))
                {
                    logger.Debug <ImagePathMapper>("Calculating media folder path from AzureBlobFileSystem settings");
                    return($"/{containerName}");
                }
            }


            // look in the uSync8.config
            return(config.GetExtensionSetting("media", "folder", string.Empty));
        }
Ejemplo n.º 2
0
 public SyncValueMapperCollection(
     uSyncConfig uSyncConfig,
     IEnumerable <ISyncMapper> items)
     : base(items)
 {
     CustomMappings = uSyncConfig.Settings.CustomMappings;
 }
Ejemplo n.º 3
0
 public SyncHandlerFactory(
     IProfilingLogger logger,
     SyncHandlerCollection syncHandlers,
     uSyncConfig config)
 {
     this.logger       = logger;
     this.syncHandlers = syncHandlers;
     this.config       = config;
 }
 public SyncValueMapperCollection(
     uSyncConfig uSyncConfig,
     SyncEntityCache entityCache,
     IEnumerable <ISyncMapper> items)
     : base(items)
 {
     EntityCache    = entityCache;
     CustomMappings = uSyncConfig.Settings.CustomMappings;
 }
Ejemplo n.º 5
0
        public uSyncDashboardApiController(
            uSyncService uSyncService,
            SyncHandlerFactory handlerFactory,
            uSyncConfig config)
        {
            this.Config       = config;
            this.uSyncService = uSyncService;

            this.settings       = Current.Configs.uSync();
            this.handlerFactory = handlerFactory;

            uSyncConfig.Reloaded += BackOfficeConfig_Reloaded;
        }
Ejemplo n.º 6
0
        public ImagePathMapper(IEntityService entityService,
                               IProfilingLogger logger, uSyncConfig config) : base(entityService)
        {
            this.logger = logger;

            siteRoot    = SystemDirectories.Root;
            mediaFolder = GetMediaFolderSetting(config);

            if (!string.IsNullOrWhiteSpace(mediaFolder))
            {
                logger.Debug <ImagePathMapper>("Media Folders: [{media}]", mediaFolder);
            }
        }
Ejemplo n.º 7
0
        public uSyncDashboardApiController(
            uSyncService uSyncService,
            SyncHandlerCollection syncHandlers,
            uSyncConfig config)
        {
            this.Config       = config;
            this.uSyncService = uSyncService;

            this.settings     = Current.Configs.uSync();
            this.syncHandlers = syncHandlers;

            uSyncConfig.Reloaded += BackOfficeConfig_Reloaded;
        }
Ejemplo n.º 8
0
        public HistoryComponent(SyncFileService syncFileService,
                                uSyncConfig syncConfig,
                                IUmbracoContextFactory umbracoContextFactory,
                                IGlobalSettings globalSettings)
        {
            this.umbracoContextFactory = umbracoContextFactory;
            this.uSyncSettings         = syncConfig.Settings;

            this.syncFileService = syncFileService;
            historyFolder        = Path.Combine(globalSettings.LocalTempPath, "usync", "history");

            uSyncService.ImportComplete += USyncService_ImportComplete;
        }
Ejemplo n.º 9
0
        public uSyncBackofficeComponent(
            IGlobalSettings globalSettings,
            uSyncConfig uSyncConfig,
            SyncHandlerFactory handlerFactory,
            IProfilingLogger logger,
            SyncFileService fileService,
            uSyncService uSyncService,
            IRuntimeState runtimeState,
            IUmbracoContextFactory umbracoContextFactory)
        {
            uSyncSettings = uSyncConfig.Settings;

            UmbracoMvcArea = globalSettings.GetUmbracoMvcArea();

            this.runtimeState = runtimeState;
            this.logger       = logger;

            this.handlerFactory = handlerFactory;

            this.syncFileService = fileService;
            this.uSyncService    = uSyncService;

            this.umbracoContextFactory = umbracoContextFactory;
        }