Hi ereryone,
I'm using Adaptavist ScriptRunner 5.3.6 for JIRA Server. I'm trying to setup up a couple of scripts, which need some configuration data, like JDBC URLs, usernames and passwords, which I don't want to hardwire into the scripts.
Where shall I store these data?
There are a two options imho:
- use JNDI (but I'm having trouble creating an instance of javax.naming.InitialContext):
import javax.naming.InitialContext
def ic = new InitialContext()
// javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory
Also, how would I tell JNDI the usernames etc.?
- read a .properties file. This works:
Properties properties = new Properties()
File propertiesFile = new File('/absolute/path/to/script/root/test.properties')
propertiesFile.withInputStream {
properties.load(it)
}
log.info properties['test.message'] // works
But I don't like the absolute path. Where should I locate the .properties file? I would guess in my <script_root>, but just using the test.properties without the path won't find the file.
Is there a way to get the script root's absolute path? Using System.getenv() or System.getProperties() does not yield the application_data path.
Thanks for your help!
Arnold