# Server environment builds

Generates all the environment variables and files for Bigscreen server apps.

Variables:
* `database` - the database - one of: `Dev`, `Staging`, `Beta`)
* `suffix` - empty for `Dev`, empty or `Next` for `Staging`, then one of `[Bravo, Charlie, Delta, Echo]` for production.

Files
* `AccessToken.key` and `AccessToken.key.pub` - public/private key pair for encoding refresh and access JWTs.  The public key is
distributed to the signal server.
* `Accounts.env` - account server environment variables for the nodejs app.
* `Accounts.pem` - the pem key to ssh into the accounts server - must be generated on AWS.
* `AllowedApps.json` - contains a list of API keys that the accounts server will accept.  These keys are distributed to every app and
are simply tokens sent along with every request.  They allow us a fast method for revoking server access. These keys should be regenerated for each new server fleet.
* `Firebase.json` - database access credentials - only the accounts server should have access.
* `Signal.env` - signal server nodejs app environment vars.
* `Signal.pem` - the pem key for signal server - generate on AWS
* `Dashboard.env` - dashboard env.
* `Dashboard.pem` - dashboard pem generated on aws.
* `signal.conf` - signal server nginx config.

Folder structure:

### Access Tokens

    ${database}AccessTokens${suffix}:
        * ${database}AccessToken${suffix}.key
        * ${database}AccessToken${suffix}.key.pub

### Accounts

    ${database}Accounts${suffix}:
        * ${database}Accounts${suffix}.env
        * ${database}Accounts${suffix}.pem
        * ${database}AllowedApps${suffix}.json
        * ${database}Firebase.json

### Signal

    ${database}Signal${suffix}:
        * ${database}Signal${suffix}.env
        * ${database}Signal${suffix}.pem

Variables:
    API_BEARER_TOKEN
    MIXPANEL_TOKEN

### Dashboard

    ${database}Dashboard${suffix}:
        * ${database}Dashboard${suffix}.env
        * ${database}Dashboard${suffix}.pem

Variables:
    BIGSCREEN_ACCOUNTS_URL
    BIGSCREEN_MODERATOR_URL
    BIGSCREEN_API_KEY
