Module: AtlConfig

Defined in:
lib/atl_config/appinfo.rb,
lib/atl_config.rb,
lib/atl_config/jdbcurl.rb,
lib/atl_config/version.rb,
lib/atl_config/serverxml.rb,
lib/atl_config/jiraconfig.rb,
lib/atl_config/confluencecfg.rb

Overview

Library for parsing Atlassian product config files.

Currently contains only the AtlConfig.dbinfo static function.

Defined Under Namespace

Classes: ConfluenceCfg, DBInfo, JDBCURL, JIRAConfig, ServerXML

Constant Summary collapse

KNOWNPRODUCTS =

Valid values for dbinfo

["confluence", "jira-software", "jira-core"]
VERSION =
"0.2.3"

Class Method Summary collapse

Class Method Details

.dbinfo(product, appdir, datadir) ⇒ AtlConfig::DBInfo

Get database connection details for a JIRA/Confluence instance.

Parameters:

  • product (String)

    Either ‘confluence’, ‘jira-software’ or ‘jira-core’

  • appdir (String)

    Path to app directory, e.g. ‘/opt/atlassian/jira’

  • datadir (String)

    Path to data directory, e.g. ‘/var/atlassian/application-data/jira’

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/atl_config/appinfo.rb', line 15

def self.dbinfo(product, appdir, datadir)
	raise "Null appdir" unless appdir
	raise "Null datadir" unless datadir
	appdir = Pathname.new(appdir)
	datadir = Pathname.new(datadir)
	raise "Product '#{product}' is not one of known products: #{KNOWNPRODUCTS.join(", ")}" unless KNOWNPRODUCTS.member? product
	raise "Nonexistent appdir '#{appdir.inspect}'" unless appdir.exist?
	raise "Nonexistent datadir '#{datadir.inspect}'" unless datadir.exist?

	dbinfo = case product 
	       when /jira.*/
		       AtlConfig::JIRAConfig.dbinfo(IO.read(datadir + "dbconfig.xml"))
	       when "confluence"
		       AtlConfig::ConfluenceCfg.dbinfo(IO.read(datadir + "confluence.cfg.xml"))
	       end
	if dbinfo.datasource then
		AtlConfig::ServerXML.dbinfo(IO.read(appdir + "conf" + "server.xml"), dbinfo.datasource)
	else
		dbinfo
	end
end