Hi, 
Are you talking about using shebangs ala:

#!/usr/bin/arangosh --server.endpoint=unix:///tmp/arangodb-tmp.sock 
--javascript.execute
print(db._users.toArray())

?
This has a problem within the way the parameters are passed. 

Usually the shell would split the strings into the array of commandline 
arguments. Arangosh then just works with that array, the shebang mechanism 
just gives 3 arguments strings:


/tmp/test2.js 
count: 3
n: 0 - /local/home/willi/src/devel/build/bin/arangosh
n: 1 - --server.endpoint=unix:///tmp/arangodb-tmp.sock --javascript.execute
n: 2 - /tmp/test2.js

So arangosh gets one argument which it will try to evaluate:
--server.endpoint=unix:///tmp/arangodb-tmp.sock --javascript.execute

followed by the filename in another string. You see that the hack to 
utilize the `--javascript.execute` doesn't work here, since its joined into 
the then broken server endpoint string.


Users on SO sugest to add another wrapper in such a case:
http://stackoverflow.com/questions/16549357/is-it-possible-to-include-command-line-options-in-the-python-shebang

Or you need to configure those through /etc/arangodb3/arangosh.conf.

Cheers, 
Willi

On Friday, September 9, 2016 at 9:58:44 PM UTC+2, Andy Barilla wrote:
>
> Looking through the current Dockerfile for 3.07, it looks like there is 
> the ability to run initalization scripts from: dockerfile-entrypoint-initdbd
>
> When using a bash script this works fine:
>
>
> #!/bin/sh
> arangosh --server.endpoint=unix:///tmp/arangodb-tmp.sock \
>   --server.password ROOTPASSWORD \
>   --javascript.execute-string "db._createDatabase('mydb', null, 
> [{username: 'user', password: 'password'}]);"
>
>
> But a javascript file doesn't because it's trying to connect to port 8529 
>  instead of through the socket and it also prompts for the password. Should 
> the docker-entrypoint.sh be changed or is there other code besides:
>
> db._createDatabase('mydb', null, [{username: 'user', password: 
> 'password'}]);
>
>
> that should be contained in the javascript file.
>
> Here's my Dockerfile
>
>
> FROM arangodb/arangodb:3.0.7
> MAINTAINER Andy Barilla
>
> ENV ARANGO_ROOT_PASSWORD=ROOTPASSWORD
>
> # ADD mydb-setup.js /docker-entrypoint-initdb.d/
>
> ADD mydb-setup.sh /docker-entrypoint-initdb.d/
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to