Remove config files from repo, provide ./configure script to generate

Closes #34
This commit is contained in:
Sandro Santilli 2012-07-20 17:31:10 +02:00
parent 352c209380
commit 5ae864a3c8
8 changed files with 52 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules node_modules
config/environments/*.js
.idea .idea

View File

@ -4,5 +4,8 @@ all:
clean: clean:
rm -rf node_modules/* rm -rf node_modules/*
check: config/environments/test.js: config/environments/test.js.example
./configure
check: config/environments/test.js
./run_tests.sh ./run_tests.sh

View File

@ -31,19 +31,22 @@ modules. At any time just wipe out the node_modules/ directory and run
Configure Configure
--------- ---------
Edit config/environments/<env>.js files Create a config/environments/<env>.js file (there are .example files
to start from).
Look at lib/cartodb/server_options for more on config Look at lib/cartodb/server_options.js for more on config
Run Run
--- ---
``` ```
node app.js [development | staging | production] node app.js <env>
``` ```
Note that caches are kept in redis. If you're not seeing what Where <env> is the name of a configuration file under config/environments/.
you expect there may be out-of-sync records in there.
Note that caches are kept in redis. If you're not seeing what you expect
there may be out-of-sync records in there.
Take a look: http://redis.io/commands Take a look: http://redis.io/commands

38
configure vendored Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
usage() {
echo "Usage: $0 [OPTION]"
echo
echo "Configuration:"
echo " --help display this help and exit"
echo " --with-pgport=NUM access PostgreSQL server on TCP port NUM"
}
PGPORT=5432
while test -n "$1"; do
case "$1" in
--help|-h)
usage
exit 0
;;
--with-pgport=*)
PGPORT=`echo "$1" | cut -d= -f2`
;;
*)
echo "Unknown option '$1'" >&2
usage >&2
exit 1
esac
shift
done
echo "PGPORT: $PGPORT"
# TODO: allow specifying configuration settings !
for f in config/environments/*.example; do
o=`dirname "$f"`/`basename "$f" .example`
echo "Writing $o"
# See http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/
sed -n "1h;1!H;\${;g;s/\(,postgres: {[^}]*port: *'\?\)[^',]*\('\?,\)/\1$PGPORT\2/;p;}" < "$f" > "$o"
done