Skip to content

Commit

Permalink
feat(node): add splash-screen config for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
danwbyrne committed Feb 8, 2019
1 parent e57489c commit b4aabc9
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/neo-one-node-http-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
"@types/koa-router": "^7.0.39",
"@types/lodash": "^4.14.120",
"@types/toobusy-js": "^0.5.2",
"@types/koa-static": "^4.0.0",
"cross-fetch": "^3.0.1",
"koa": "^2.7.0",
"koa-compose": "^4.1.0",
"koa-compress": "^3.0.0",
"koa-ratelimit-lru": "^1.0.2",
"koa-router": "^7.4.0",
"koa-static": "^5.0.0",
"lodash": "^4.17.11",
"rxjs": "^6.4.0",
"toobusy-js": "^0.5.1",
Expand Down
9 changes: 9 additions & 0 deletions packages/neo-one-node-http-rpc/src/rpcServer$.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as https from 'https';
import Application from 'koa';
import rateLimit from 'koa-ratelimit-lru';
import Router from 'koa-router';
import serve from 'koa-static';
import { combineLatest, Observable, of as _of } from 'rxjs';
import { distinctUntilChanged, map, publishReplay, refCount } from 'rxjs/operators';
import {
Expand Down Expand Up @@ -33,6 +34,10 @@ export interface Environment {
readonly port: number;
readonly host: string;
};

readonly splashScreen?: {
readonly path: string;
};
}
export interface Options {
readonly server?: ServerOptions;
Expand Down Expand Up @@ -115,6 +120,10 @@ export const rpcServer$ = ({
router.use(tooBusyCheck(tooBusyCheckOptions));
}

if (environment.splashScreen !== undefined) {
router.get('index', '/', serve(environment.splashScreen.path));
}

router.use(cors).post(rpcMiddleware.name, rpcMiddleware.path, rpcMiddleware.middleware);

app.use(router.routes());
Expand Down
2 changes: 1 addition & 1 deletion scripts/DockerfileNode
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM neotracker/neo-one-circleci-node:10.13.0-1 as builder
RUN mkdir -p tmp/neo-one
RUN mkdir -p /tmp/neo-one
WORKDIR tmp/neo-one

COPY package.json tsconfig.json lerna.json gulpfile.js yarn.lock ./
Expand Down
35 changes: 34 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,21 @@
dependencies:
"@types/koa" "*"

"@types/koa-send@*":
version "4.1.1"
resolved "https://registry.yarnpkg.com/@types/koa-send/-/koa-send-4.1.1.tgz#88f57cbe0343c8204903f9096d8ff6b98ec3296f"
integrity sha512-ODeofnQxlkAl5PvJXhgOF/hjX9cH47oDFDqH9nE0G6zcp/Rr0vjswe7tuA+b0ZhlBrkfmN9X8VhRqQCBeOtZrw==
dependencies:
"@types/koa" "*"

"@types/koa-static@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/koa-static/-/koa-static-4.0.0.tgz#4cddce6adf45221bacfb2842b3621dc92f4d642c"
integrity sha512-qjT7JIV79ZQ9MFjrWLvmnrX9St4DFuT2tzSRpkzQHx4QQBrLR04FSZHhoFkrgNgojkTuX2uxshdoThxhIMWVqw==
dependencies:
"@types/koa" "*"
"@types/koa-send" "*"

"@types/koa@*", "@types/koa@^2.0.48":
version "2.0.48"
resolved "https://registry.yarnpkg.com/@types/koa/-/koa-2.0.48.tgz#29162783029d3e5df8b58c55f6bf0d35f78fc39f"
Expand Down Expand Up @@ -12680,6 +12695,24 @@ koa-router@^7.4.0:
path-to-regexp "^1.1.1"
urijs "^1.19.0"

koa-send@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-5.0.0.tgz#5e8441e07ef55737734d7ced25b842e50646e7eb"
integrity sha512-90ZotV7t0p3uN9sRwW2D484rAaKIsD8tAVtypw/aBU+ryfV+fR2xrcAwhI8Wl6WRkojLUs/cB9SBSCuIb+IanQ==
dependencies:
debug "^3.1.0"
http-errors "^1.6.3"
mz "^2.7.0"
resolve-path "^1.4.0"

koa-static@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/koa-static/-/koa-static-5.0.0.tgz#5e92fc96b537ad5219f425319c95b64772776943"
integrity sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==
dependencies:
debug "^3.1.0"
koa-send "^5.0.0"

koa-webpack@^5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/koa-webpack/-/koa-webpack-5.2.1.tgz#2594acdb37c6a76874abf153b26f453083472138"
Expand Down Expand Up @@ -14464,7 +14497,7 @@ mute-stream@~0.0.4:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==

mz@^2.6.0:
mz@^2.6.0, mz@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==
Expand Down

0 comments on commit b4aabc9

Please sign in to comment.