Browse Source

Fixed bug in import command

Jim Barritt 11 months ago
parent
commit
96adcacf34

+ 1 - 1
apps/petitions/decode-app/config/server.yaml

@@ -1,7 +1,7 @@
1 1
 development:
2 2
   mongo-port:      27017
3 3
   mongo-host:      "127.0.0.1"
4
-  database:        "decode-dev"
4
+  database:        "decode_sample"
5 5
   chainspace-host: "http://127.0.0.1"
6 6
   chainspace-port: 5010
7 7
                

+ 6 - 1
apps/petitions/decode-app/ops/local/decode-app.sh

@@ -38,7 +38,7 @@ function logs {
38 38
     tail -n200 ${FOLLOW} ${DECODE_APP_LOG_FILE}
39 39
 }
40 40
 
41
-package() {
41
+function package {
42 42
   echo -e "\nCompiling and packagaing decode-app using lein...\n"
43 43
 
44 44
   check_pre_requisites
@@ -49,6 +49,11 @@ package() {
49 49
   echo -e "\nPackage Complete and should be in target dir\n"
50 50
 }
51 51
 
52
+function up {
53
+    echo -e  "\nBringing up local decode-app in background, to access, type 'jobs' and 'fg <n>' where n is the job number. To kill 'do decode-app down'.\n"
54
+
55
+    java -jar target/decode-app-0.1.0-SNAPSHOT-standalone.jar &> ${DECODE_APP_LOG_FILE} &
56
+}
52 57
 function init-db {
53 58
     echo -e "\nCleaning and initialising a sample database in [${DECODE_APP_DB_NAME}]...\n"
54 59
 

+ 6 - 1
apps/petitions/decode-app/ops/local/mongo.lib.sh

@@ -19,6 +19,11 @@ function mongo/connection {
19 19
     echo "mongodb://${MONGO_HOST}:${MONGO_PORT}/${DB_NAME}"
20 20
 }
21 21
 
22
+function mongo/shell {
23
+    DB_NAME=${1:-}
24
+    mongo $(mongo/connection ${DB_NAME})
25
+}
26
+
22 27
 function mongo/eval {
23 28
     DB_NAME=$1
24 29
     MONGO_CMD=$2
@@ -49,7 +54,7 @@ function mongo/import {
49 54
     COLLECTION_NAME=$2
50 55
     IMPORT_FILE=$3
51 56
     echo "Importing to db [${DB_NAME}:${COLLECTION_NAME}] from file [${IMPORT_FILE}]..."
52
-    mongoimport --host=${MONGO_HOST} --port=${MONGO_PORT} --db=${DB_NAME} --collection=${COLLECTION_NAME} --jsonArray --file ${SCRIPT_HOME}/../sample-data/users.json
57
+    mongoimport --host=${MONGO_HOST} --port=${MONGO_PORT} --db=${DB_NAME} --collection=${COLLECTION_NAME} --jsonArray --file ${IMPORT_FILE}
53 58
 
54 59
 
55 60
 

+ 4 - 0
apps/petitions/decode-app/ops/local/mongo.sh

@@ -54,6 +54,10 @@ function down {
54 54
     echo -e "\nMongo stopped."
55 55
 }
56 56
 
57
+function shell {
58
+    mongo/shell
59
+}
60
+
57 61
 
58 62
 lib/process_commands $@
59 63