Skip to content

Commit

Permalink
Switch to JSON HBS template for defining OSGi configurations (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert authored Jan 10, 2024
1 parent 1abb223 commit 90bcd56
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 119 deletions.
3 changes: 3 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<action type="update" dev="sseifert">
Update to Handler 2.x.
</action>
<action type="update" dev="sseifert" issue="38">
Switch to JSON HBS template for defining OSGi configurations.
</action>
<action type="update" dev="sseifert">
Update dependencies.
</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ files:

#end
# AEM OSGi System Configuration
- file: ${projectName}-aem-cms-config.provisioning
- file: ${projectName}-aem-cms-config.osgiconfig.json
dir: packages
template: ${projectName}-aem-cms-config.provisioning.hbs
template: ${projectName}-aem-cms-config.osgiconfig.json.hbs
validators:
- none # allow trailing commas in JSON picked up by post processor
postProcessors:
- aem-contentpackage-osgiconfig
postProcessorOptions:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"configurations": {

// Set loglevel for project-specific bundles
"org.apache.sling.commons.log.LogManager.factory.config-${projectName}": {
"org.apache.sling.commons.log.file": "logs/error.log",
"org.apache.sling.commons.log.level": "{{app.logLevel}}",
"org.apache.sling.commons.log.names": ["io.wcm","${package}"]
},

// Disable built-in AEM link checker by default (enable it only when configured properly).
"com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory": {
"linkcheckertransformer.disableChecking": true
},

#if ( $optionContextAwareConfig == "y" )
#if ( $optionAemVersion == "6.5" )
// Update Context-Aware config settings as it is configured by default in latest AEM version
"org.apache.sling.caconfig.management.impl.ConfigurationManagementSettingsImpl": {
"ignorePropertyNameRegex": ["^(jcr|cq):.+$","^sling:resourceType$"],
"configCollectionPropertiesResourceNames": ["jcr:content","."]
},

#end
// Context path strategy
"io.wcm.caconfig.extensions.contextpath.impl.RootTemplateContextPathStrategy-${projectName}": {
"templatePaths": ["#if($optionEditableTemplates=='y')/conf/${projectName}/settings/wcm/templates/homepage#else/apps/${projectName}/core/templates/homepage#end"],
"minLevel": 1,
"maxLevel": 5,
"contextPathRegex": "^/content/(dam/)?(${projectName}/.*)?$",
"configPathPatterns": ["/conf/$2"]
},

// Store context-aware configuration in cq:Page nodes in /conf
"io.wcm.caconfig.extensions.persistence.impl.PagePersistenceStrategy": {
"enabled": true
},

#end
#if ( $optionWcmioHandler == "y" )
// Service user mapping for wcm.io URL handler
"org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-${projectName}-wcmio-handler-wcm": {
"user.mapping": [
"io.wcm.handler.url:clientlibs-service=[sling-scripting]",
"io.wcm.wcm.commons:component-properties=[sling-scripting]"
]
},

// Service user mapping for wcm.io Media Handler
"org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-${projectName}-wcmio-handler-media-dynamicmedia": {
"user.mapping": [
"io.wcm.handler.media:dynamic-media-support=[configuration-reader-service]"
]
},

// Required DS components for systemready check
"org.apache.felix.hc.generalchecks.DsComponentsCheck-${projectName}-systemready": {
"hc.name": "${projectName} - Required Components",
"hc.tags": ["${projectName}","systemready"],
"statusForMissing": "TEMPORARILY_UNAVAILABLE",
"components.list": [
"${package}.config.impl.LinkHandlerConfigImpl",
"${package}.config.impl.MediaFormatProviderImpl",
"${package}.config.impl.MediaHandlerConfigImpl",
"io.wcm.caconfig.extensions.contextpath.impl.RootTemplateContextPathStrategy",
"io.wcm.caconfig.extensions.persistence.impl.PagePersistenceStrategy",
"io.wcm.handler.mediasource.dam.impl.dynamicmedia.DynamicMediaSupportServiceImpl"
]
},

#end
},

"configurations:author": {

// Show "Sites" view in TouchUI after login
"com.day.cq.commons.servlets.RootMappingServlet": {
"rootmapping.target": "/sites.html"
},

#if ( $optionAemVersion == "cloud" )
#[[{{#if aem.disableAuthorUsageStatisticsCollection ~}}]]#
// Disable usage tracking by default for admins (esp. for local usage)
"com.adobe.cq.experiencelog.impl.ExperienceLogConfigServlet": {
"enabled": false
},

{{/if ~}}
#end
#if ( $optionWcmioHandler == "y" )
// Instance type
"io.wcm.wcm.commons.instancetype.impl.InstanceTypeServiceImpl": {
"instance.type": "author"
},

// Service user mapping for wcm.io Media Handler
"org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-${projectName}-wcmio-handler-media-metadata": {
"user.mapping": [
"io.wcm.handler.media:dam-rendition-metadata=[dam-writer-service]"
]
},

// Support previews of inline images in edit dialogs on Authoring instances for these resource types
"io.wcm.handler.media.impl.InlineImageAuthorPreviewServlet": {
"sling.servlet.resourceTypes": ["wcm-io/wcm/core/components/wcmio/responsiveimage/v1/responsiveimage"]
},

#end
},

"configurations:publish": {

#if ( $optionContextAwareConfig == "y" )
// Disable Configuration Editor on publish
"io.wcm.caconfig.editor.impl.EditorConfig": {
"enabled": false
},

#end
// Disable default renderings for Sling GET servlet on publish
"org.apache.sling.servlets.get.DefaultGetServlet": {
"enable.html": "false",
"enable.json": "true",
"enable.txt": "false",
"enable.xml": "false",
"index": "false",
"index.files": ["index","index.html"],
"aliases": "xml:pdf",
"json.maximumresults": 100
},

#if ( $optionWcmioHandler == "y" )
// Instance type
"io.wcm.wcm.commons.instancetype.impl.InstanceTypeServiceImpl": {
"instance.type": "publish"
},

#end
},

"repoinit": [
// Create root folder below /apps for application
"create path /apps/${projectName}(sling:Folder)"
]
}

This file was deleted.

0 comments on commit 90bcd56

Please sign in to comment.