Skip to content

Frontend

AOrps edited this page Apr 27, 2022 · 7 revisions

Directory Location

  • src/front-end

Requirements

  • Google oauth2 credentials { CLIENT_ID + CLIENT_SECRET }
  • .env file
  • valid-sigs.json file

Generating Google oauth2 credentials

Contents of .env file

# To create .env file
touch .env
  • .env must have the following 5 environment variables
    • GOOGLE_CLIENT_ID
      • This is provided to the developer via Google.
    • GOOGLE_CLIENT_SECRET
      • This is provided to the developer via Google.
    • SESSION_KEY
      • For the developer to choose. (At the time of writing this it is some random characters but there is definitely a better (and more secure) way of doing this and may be omitted in the future)
    • BENDPOINT
      • This should be the endpoint (server, area, etc.) where the src/api portion of the code is being run
      • Be sure to take special note of which protocol that the api server runs. i.e http vs https
    • TYPE
      • Helps maintainers / testers
      • Option between "test" or "prod"
        • "test" : tests on localhost/oauth2/callback i.e. for testing
        • "prod" : tests on sig-track.xyz/oauth2/callback endpoint i.e. for production
      • Default is "test" functionality

Example of .env file

  • The following is an example. (I would be really surprised and impressed with myself if it somehow works in production using this)
GOOGLE_CLIENT_ID="984389xxx-2jn3nxxx.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="GOCSPX-nasdjfn4xxxxxxx"
SESSION_KEY="nfknrkfnf5igi455tgkndg5id"
BENDPOINT="ec2-yeehaw.aws.com"
TYPE="prod"

Contents of valid-sigs.json file

  • File should be a valid json list.

Example of valid-sigs.json file

[ "ai", "minecraft", "swe", "sig•mal", "playas-but-better-faster-harder-stronger", "cloud" ] 

TLDR

# Change to src/front-end directory
cd src/front-end

# .env file
cat <<EOF > .env
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
SESSION_KEY=""
BENDPOINT=""
TYPE=""
EOF

# valid-sigs.json file
cat <<EOF > valid-sigs.json
[ "", ""] 
EOF