[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [metrics-web/master] Prevent password in context.xml from being overwritten by Git.



Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon, 27 Dec 2010 15:49:37 +0100
Subject: Prevent password in context.xml from being overwritten by Git.
Commit: d8c0302a6955a7021437b4da874ffb5510493bea

---
 .gitignore               |    3 +++
 build.xml                |   10 +++++++++-
 etc/context.xml          |   13 -------------
 etc/context.xml.template |   13 +++++++++++++
 4 files changed, 25 insertions(+), 14 deletions(-)
 delete mode 100644 etc/context.xml
 create mode 100644 etc/context.xml.template

diff --git a/.gitignore b/.gitignore
index 9a4df84..2ebd1c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,6 @@ ernie.war
 # Compiled class files
 classes/
 
+# Possibly modified config file
+etc/context.xml
+
diff --git a/build.xml b/build.xml
index 948f7d6..eb3b12a 100644
--- a/build.xml
+++ b/build.xml
@@ -6,10 +6,18 @@
   <property name="libs" value="lib"/>
   <property name="config" value="etc"/>
   <property name="webxmlfile" value="${config}/web.xml"/>
+  <property name="contextxmltemplate"
+            value="${config}/context.xml.template"/>
+  <property name="contextxml" value="${config}/context.xml"/>
   <property name="warfile" value="ernie.war"/>
 
+  <target name="init">
+    <copy file="${contextxmltemplate}" tofile="${contextxml}"/>
+  </target>
+
   <!-- Compile all servlets and plain Java classes. -->
-  <target name="compile">
+  <target name="compile"
+          depends="init">
     <mkdir dir="${classes}"/>
     <javac destdir="${classes}"
            srcdir="${sources}"
diff --git a/etc/context.xml b/etc/context.xml
deleted file mode 100644
index 00f14fe..0000000
--- a/etc/context.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<Context cookies="false">
-  <Resource name="jdbc/tordir"
-            type="javax.sql.DataSource"
-            auth="Container"
-            username="metrics"
-            password="password"
-            driverClassName="org.postgresql.Driver"
-            url="jdbc:postgresql://localhost/tordir"
-            maxActive="8"
-            maxIdle="4"
-            maxWait="15000"/>
-</Context>
-
diff --git a/etc/context.xml.template b/etc/context.xml.template
new file mode 100644
index 0000000..00f14fe
--- /dev/null
+++ b/etc/context.xml.template
@@ -0,0 +1,13 @@
+<Context cookies="false">
+  <Resource name="jdbc/tordir"
+            type="javax.sql.DataSource"
+            auth="Container"
+            username="metrics"
+            password="password"
+            driverClassName="org.postgresql.Driver"
+            url="jdbc:postgresql://localhost/tordir"
+            maxActive="8"
+            maxIdle="4"
+            maxWait="15000"/>
+</Context>
+
-- 
1.7.1