Skip to Content
Building Scalable Apps with Redis and Node.js
book

Building Scalable Apps with Redis and Node.js

by Joshua Johanan
September 2014
Intermediate to advanced
316 pages
7h 6m
English
Packt Publishing
Content preview from Building Scalable Apps with Redis and Node.js

Scripting our new tools

We have automated some tasks, but we have created an issue where we must run two to three commands to accomplish each task. We want to always shoot for one command. We will create a script to launch our development server and collect the static files. First, create a file named set_env.sh. This file will load our environment files so that we can then run our different commands. Paste this into it:

#!/bin/bash
if [ $# -ne 1 ]; then
  echo "Please pass in the environment as the first argument"
  exit 1
fi

source ./$1.env
source ./$1_secret.env

if [ $? != 0 ]; then
  echo "Create the needed environment files"
  exit $?
fi

This uses bash and if you have never scripted with bash before, it can look a little strange. The first if condition ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reactive Programming with Node.js

Reactive Programming with Node.js

Fernando Doglio
Node: Up and Running

Node: Up and Running

Tom Hughes-Croucher, Mike Wilson
Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781783984480Supplemental Content