Alex O'Ree created JSPWIKI-1188:
-----------------------------------

             Summary: Support system property replacement for jsp wiki 
configuration properties
                 Key: JSPWIKI-1188
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-1188
             Project: JSPWiki
          Issue Type: Improvement
          Components: Core & storage
            Reporter: Alex O'Ree


As a sysadmin/integrator/user of jspwiki, i would really like to automate as 
much as integration work as possible for my use case. This includes
 * generating markdown and attachments to "seed" or initialize the content for 
jsp wiki
 * task automating the deployment of jspwiki's war into tomcat
 * configuring jsp wiki via the properties file

i also need to be able to run on multiple systems, platforms and containers.

So that said, jspwiki's properties file has a few settings that require paths 
for storing content, such as
 * jspwiki.fileSystemProvider.pageDir
 * jspwiki.workDir
 * jspwiki.basicAttachmentProvider.storageDir

When running in tomcat from the command line, the bin path is typically the 
current working directory, meaning relative paths are based on that path. 
However when ran as a windows or systemd service, sometimes the current working 
directory is not bin, it's up folder up. Anyhow, relative paths are a poor 
solution in this case.

In my experience, since i know i'm running on tomcat, i almost always use the 
system property `catalina.base` for locating paths relative to tomcat for extra 
storage locations for stuff.

Long story short, most systems support property substitution (maven uses 
velocity for example) and i'd like jspwiki to do the same.

Example file (as stored)
 * jspwiki.fileSystemProvider.pageDir=${catalina.base}/wiki
 * jspwiki.workDir=${catalina.base}/work/wiki
 * jspwiki.basicAttachmentProvider.storageDir=${catalina.base}/wiki

which would be resolved to something like
 * jspwiki.fileSystemProvider.pageDir=c:/tomcat/wiki
 * jspwiki.workDir=c:/tomcat/work/wiki
 * jspwiki.basicAttachmentProvider.storageDir=c:/tomcat/wiki

where catalina.base = c:/tomcat. This would effectively enable relative paths 
with some safe guards.

 

Now as far as implementation, i can think of a few options
 * a DIY, 0 dependency approach to location a ${ and a } in a property value to 
do the substitution
 * maybe use velocity to resolve it, assuming you want to add velocity to the 
dependency list for this project
 * maybe apache commons config might be a better option as they already merge 
system environment variables and system properties. but i'm not clear if it 
does property substitution out of the box

i'm will to support either way



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to