Commits

Stephen McKamey committed 9a0d9ee

better error messaging when resolving config

Comments (0)

Files changed (2)

-#!/bin/sh
+#!/bin/bash
+set -e
+
+# --------------------------------------------------------
+# Before using this script, need to ensure
+# ~/.gnupg/ contains key corresponding to KEYNAME, and
+# ~/.m2/settings.xml contains OSS Sonatype credentials
+# --------------------------------------------------------
+
+KEYNAME=-Dgpg.keyname=EE82F9AB
+
+if [ $1 != '' ]; then
+	PASSPHRASE=-Dgpg.passphrase=$1
+else
+	PASSPHRASE=''
+fi
 
 clear;clear
 
 cd duel-runtime
-mvn clean deploy -DperformRelease=true -Dgpg.keyname=EE82F9AB
+mvn clean deploy -DperformRelease=true ${KEYNAME} ${PASSPHRASE}
 cd ..
 
 cd duel-compiler
-mvn clean deploy -U -DperformRelease=true -Dgpg.keyname=EE82F9AB
+mvn clean deploy -U -DperformRelease=true ${KEYNAME} ${PASSPHRASE}
 cd ..
 
 cd duel-maven-plugin
-mvn clean deploy -U -DperformRelease=true -Dgpg.keyname=EE82F9AB
+mvn clean deploy -U -DperformRelease=true ${KEYNAME} ${PASSPHRASE}
 cd ..
 
 cd duel-staticapps
-mvn clean deploy -U -DperformRelease=true -Dgpg.keyname=EE82F9AB
+mvn clean deploy -U -DperformRelease=true ${KEYNAME} ${PASSPHRASE}
 cd ..
 
 cd duel-staticapps-maven-plugin
-mvn clean deploy -U -DperformRelease=true -Dgpg.keyname=EE82F9AB
+mvn clean deploy -U -DperformRelease=true ${KEYNAME} ${PASSPHRASE}

duel-staticapps/src/main/java/org/duelengine/duel/staticapps/RoutingServlet.java

 			// load from config file
 			configPath = System.getProperty("org.duelengine.duel.staticapps.configPath");
 			if (configPath == null || configPath.isEmpty()) {
+				log.info("Loading config-path from WEB-INF/web.xml");
 				configPath = servletConfig.getInitParameter("config-path");
 			}
 			if (configPath == null || configPath.isEmpty()) {
 				if (configFile.exists()) {
 					log.info("Loading config from file path: "+configFile.getPath());
 					config = new ObjectMapper().reader(SiteConfig.class).readValue(configFile);
+				} else {
+					log.error("File not found from 'config-path' param: "+configPath);
+					configPath = null;
 				}
 			}
 
 		} catch (Throwable ex) {
-			log.error("Error loading staticapp config from 'config-path' param in WEB-INF/web.xml: "+configPath, ex);
+			log.error("Error loading staticapp config from 'config-path' param: "+configPath, ex);
 			config = null;
 		}
 
 			try {
 				configPath = System.getProperty("org.duelengine.duel.staticapps.configResource");
 				if (configPath == null || configPath.isEmpty()) {
+					log.info("Loading config-resource from WEB-INF/web.xml");
 					configPath = servletConfig.getInitParameter("config-resource");
 				}
 				log.info("Loading config from resource: "+configPath);
 				config = new ObjectMapper().reader(SiteConfig.class).readValue(stream);
 
 			} catch (Throwable ex) {
-				log.error("Error loading staticapp config from 'config-resource' param in WEB-INF/web.xml: "+configPath, ex);
+				log.error("Error loading staticapp config from 'config-resource' param: "+configPath, ex);
 				config = null;
 			}
 		}