Add Servlet Sample
[aaf/authz.git] / auth / sample / bin / service.sh
index da2eb85..6b694ad 100644 (file)
@@ -7,6 +7,10 @@ LOCAL=/opt/app/osaaf/local
 DATA=/opt/app/osaaf/data
 PUBLIC=/opt/app/osaaf/public
 CONFIG=/opt/app/aaf_config
+
+# If doesn't exist... still create
+mkdir -p /opt/app/osaaf
+
 # Temp use for clarity of code
 FILE=
 
@@ -85,7 +89,8 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
     echo cadi_longitude=${LONGITUDE} >> ${TMP}
     echo cadi_x509_issuers=${CADI_X509_ISSUERS} >> ${TMP}
     echo aaf_register_as=${AAF_REGISTER_AS} >> ${TMP}
-    echo aaf_locate_url=https://${AAF_REGISTER_AS}:8095 >> ${TMP}
+    AAF_LOCATOR_AS=${AAF_LOCATOR_AS:=$AAF_REGISTER_AS}
+    echo aaf_locate_url=https://${AAF_LOCATOR_AS}:8095 >> ${TMP}
 
     cat $TMP
 
@@ -93,9 +98,17 @@ if [ ! -e $LOCAL/org.osaaf.aaf.props ]; then
         cadi_etc_dir=$LOCAL \
         cadi_prop_files=$CONFIG/local/initialConfig.props:$CONFIG/local/aaf.props:${TMP}
     rm ${TMP}
-    # Default Password for Default Cass
-    CASS_PASS=$("$JAVA" -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar cadi digest "cassandra" $LOCAL/org.osaaf.aaf.keyfile)
-    sed -i.backup -e "s/\\(cassandra.clusters.password=enc:\\)/\\1$CASS_PASS/" $LOCAL/org.osaaf.aaf.cassandra.props
+
+    # Cassandra Config stuff
+    # Default is expect a Cassandra on same Node
+    CASS_HOST=${CASS_HOST:="aaf_cass"}
+    CASS_PASS=$("$JAVA" -jar $CONFIG/bin/aaf-cadi-aaf-*-full.jar cadi digest "${CASSANDRA_PASSWORD:-cassandra}" $LOCAL/org.osaaf.aaf.keyfile)
+    CASS_NAME=${CASS_HOST/:*/}
+    sed -i.backup -e "s/\\(cassandra.clusters=\\).*/\\1${CASSANDRA_CLUSTERS:=$CASS_HOST}/" \
+                  -e "s/\\(cassandra.clusters.user=\\).*/\\1${CASSANDRA_USER:=cassandra}/" \
+                  -e "s/\\(cassandra.clusters.password=enc:\\).*/\\1$CASS_PASS/" \
+                  -e "s/\\(cassandra.clusters.port=\\).*/\\1${CASSANDRA_PORT:=9042}/" \
+                  $LOCAL/org.osaaf.aaf.cassandra.props
 
     if [ -n "$CM_CA_LOCAL" ]; then
       if [ -n "$CM_CA_PASS" ]; then