Skip to content

Commit

Permalink
feat: end HTTP support
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed Jan 3, 2017
1 parent c3e3e27 commit 1d7af59
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
43 changes: 34 additions & 9 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ A few steps are required to setup this project but it shouldn't take long.

All commands mentioned should be ran from the project root.

## Prerequisite Software
## <a name="prerequisites"></a> Prerequisite Software

* [Git](http://git-scm.com) (a **GitHub app** exists for [Mac or Windows](http://desktop.github.com), but use whatever you prefer).
* [Node.js](http://nodejs.org), (version `>=4.2.1` `<5`). It should include [npm](https://www.npmjs.com/) (node package manager).

## Getting started
## <a name="start"></a> Getting started

### 1. Install packages
All packages for this project can be retrieved by executing following command:
Expand Down Expand Up @@ -41,7 +41,7 @@ These are the default values that can be altered via an override:
'match': 'v2.2',
'static-data': 'v1.2',
},
gameTime: 60 * 60 * 1000
gameTime: 45 * 60 * 1000
}
```

Expand All @@ -51,7 +51,32 @@ This is a guide on how to set them up.

#### 3.1 Create `api.key`
Create an account at [developer.riotgames.com](https://developer.riotgames.com/). Now you have an api key.
Create a file named `api.key` and add the key to it (no newline). Place it at the root of the project.
Create a file named `api.key` and add the key to it.
Place it in a `./secure` folder.

#### 3.2 Create `cert.pem` and `key.pem`
We limit ourselves to HTTPS and do not support HTTP (even in development).
The advantages:
- No need for two types of the same server
- Any issues regarding SSL can be found during development
- HTTP can't accidentally be activated in production

The disadvantages:
- requires certificates (in development this can be annoying)

Create a certificate and private key (see [3.2.1](DEVELOPER.md#lets-encrypt) or [3.2.2](DEVELOPER.md#openssl)), name them `cert.pem` and `key.pem` respectively.
Place them in a `./secure` folder.

##### <a name="lets-encrypt"></a> 3.2.1 Let's Encrypt
The certificates provided by [Let's Encrypt](https://letsencrypt.org/) are free and are [trusted by almost all browsers](https://letsencrypt.org/docs/certificate-compatibility/).
Find yourself an [ACME client](https://letsencrypt.org/docs/client-options/) and generate a certificate.

##### <a name="openssl"></a> 3.2.2 OpenSSL
With OpenSSL you can create self signed certificates like this:
```shell
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
```
The browser will warn you that the website is insecure but as you are running this locally you can ignore this.

#### 3.2 Run
```shell
Expand All @@ -60,12 +85,12 @@ npm run match-server
```

### 4. Run a HTTP server (webpack-dev-server)
I recommend the [webpack-dev-server](https://github.com/webpack/webpack-dev-server) which is included as a packages.
I recommend the [webpack-dev-server](https://github.com/webpack/webpack-dev-server) which is included as a package.
```shell
npm run server
```

## Reddit Release
## <a name="reddit"></a> Reddit Release
Every release a python script will generate a post on reddit. To improve this script or to create new scripts the following software is required:

* [Python](https://www.python.org/downloads/), (version `>=3.5.1`). It should include [pip](https://pypi.python.org/pypi/pip) (Pip Installs Packages).
Expand All @@ -81,7 +106,7 @@ Every release a python script will generate a post on reddit. To improve this sc
```

## <a name="clang-format"></a> ClangFormat
ClangFormat will format `TypeScript` and `JavaScript` code according to the style-guide ([CONTRIBUTING.md](CONTRIBUTING#rules)) of this project.
ClangFormat will format `TypeScript` and `JavaScript` code according to the style-guide ([CONTRIBUTING.md](CONTRIBUTING.md#rules)) of this project.
The following command will format all `.ts` files:
```shell
npm run format
Expand All @@ -100,8 +125,8 @@ Following VSCode settings are required:
}
```

## <a name="tslint"></a> CSScomb
CSScomb will format `CSS` code according to the style-guide ([CONTRIBUTING.md](CONTRIBUTING#rules)) of this project.
## <a name="csscomb"></a> CSScomb
CSScomb will format `CSS` code according to the style-guide ([CONTRIBUTING.md](CONTRIBUTING.md#rules)) of this project.
The following command will format all `.css` files:
```shell
npm run format:css
Expand Down
12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,10 @@
"webpack:client:test": "npm run webpack -- --config config/build/webpack.client.test.js",
"prewebpack:server:test": "npm run clean:build:spec:server && npm run lint:server:test",
"webpack:server:test": "npm run webpack -- --config config/build/webpack.server.test.js",
"start": "npm run http-server:dev",
"server": "npm run http-server:dev",
"http-server:dev": "npm run http-server -- --env.dev",
"http-server:prod": "npm run http-server",
"http-server": "npm run webpack-dev-server -- --config config/build/webpack.client.js --watch --content-base src/",
"http-server-secure:dev": "npm run http-server-secure -- --env.dev",
"http-server-secure:prod": "npm run http-server-secure",
"http-server-secure": "npm run http-server -- --https --cert=./secure/cert.pem --key=./secure/key.pem",
"server": "npm run https-server:dev",
"https-server:dev": "npm run https-server -- --env.dev",
"https-server:prod": "npm run https-server -- --bail",
"https-server": "npm run webpack-dev-server -- --config config/build/webpack.client.js --watch --content-base src/ --https --cert=./secure/cert.pem --key=./secure/key.pem",
"static-server": "npm run static-server:dev",
"static-server:dev": "npm run build:server:dev && node build/dist/server/static-server.js",
"static-server:prod": "npm run build:server:prod && node build/dist/server/static-server.js",
Expand Down

0 comments on commit 1d7af59

Please sign in to comment.