From 131a8b556441989e52690e773fff615416fd4549 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Fri, 25 Aug 2017 13:58:51 -0700 Subject: [PATCH] updated readme. made redis optional in dev --- README.md | 20 ++++++++++++++++---- package-lock.json | 6 ++++++ package.json | 1 + server/storage.js | 7 ++++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 114ee240..37f642a0 100644 --- a/README.md +++ b/README.md @@ -16,17 +16,23 @@ A file sharing experiment which allows you to send encrypted files to other user ## Requirements - [Node.js 8.2+](https://nodejs.org/) -- [Redis server](https://redis.io/) +- [Redis server](https://redis.io/) (optional for development) +- [AWS S3](https://aws.amazon.com/s3/) or compatible service. (optional) -**NOTE:** To run the project, make sure you have a Redis server running locally: +--- + +## Development + +To start an ephemeral development server run: ```sh -$ redis-server /usr/local/etc/redis.conf +npm install +npm start ``` --- -## How to use it +## Commands | Command | Description | |------------------|-------------| @@ -39,6 +45,12 @@ $ redis-server /usr/local/etc/redis.conf --- +## Configuration + +The server is configured with environment variables. See [server/config.js] for all options and [docs/docker.md](doc/docker.md) for examples. + +--- + ## Localization Firefox Send localization is managed via [Pontoon](https://pontoon.mozilla.org/projects/test-pilot-firefox-send/), not direct pull requests to the repository. If you want to fix a typo, add a new language, or simply know more about localization, please get in touch with the [existing localization team](https://pontoon.mozilla.org/teams/) for your language, or Mozilla’s [l10n-drivers](https://wiki.mozilla.org/L10n:Mozilla_Team#Mozilla_Corporation) for guidance. diff --git a/package-lock.json b/package-lock.json index 573968a4..8b371613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9423,6 +9423,12 @@ "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.3.1.tgz", "integrity": "sha1-gdgm9F+pyLIBH0zXoP5ZfSQdRCs=" }, + "redis-mock": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/redis-mock/-/redis-mock-0.20.0.tgz", + "integrity": "sha1-lKOVhlurvOv1OLa1mUFyPkgHMBA=", + "dev": true + }, "redis-parser": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz", diff --git a/package.json b/package.json index c358edd2..3b65ca90 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "prettier": "^1.5.3", "proxyquire": "^1.8.0", "raven-js": "^3.17.0", + "redis-mock": "^0.20.0", "require-from-string": "^1.2.1", "rimraf": "^2.6.1", "selenium-webdriver": "^3.5.0", diff --git a/server/storage.js b/server/storage.js index 36b040af..7abd705d 100644 --- a/server/storage.js +++ b/server/storage.js @@ -10,7 +10,12 @@ const mozlog = require('./log'); const log = mozlog('send.storage'); -const redis = require('redis'); +const redis_lib = + config.env === 'development' && config.redis_host === 'localhost' + ? 'redis-mock' + : 'redis'; + +const redis = require(redis_lib); const redis_client = redis.createClient({ host: config.redis_host, connect_timeout: 10000