Skip to content

Latest commit

 

History

History
149 lines (102 loc) · 4.68 KB

EnvironmentVariable.md

File metadata and controls

149 lines (102 loc) · 4.68 KB

Environment Variables

To run this project, you will need to add the following environment variables to your .env file


What's meaning of ...

$clientID
$clientSecret
$mongodbURI
$jwtToken
$jwtExpirationTime
$mailUser
$mailPass

clientID & clientSecret

Client ID & Client Secret is generated by GitHub OAuth App!
Follow each step to create your own GitHub Oauth App...

  1. Login at GitHub & Access to OAuth Apps

     GitHub -> Settings -> Developer settings -> OAuth Apps
  2. Click New OAuth App & insert your own data

     Application name: <any application name you want>
     Homepage URL: <any URL format you want>
     Authorization callback URL: http://localhost:3000/login

    Authorization callback URL
    The Authorization callback URL is a redirect url that should be returned after you complete the OAuth login, with react server ip before and /login after.
    When you test with local environment, you should use http://localhost:3000/login

  3. Get your OAuth App's Client ID & Client Secret
    Click Generate a new client secret to get your own ClientID & Client Secret!

mongodbURI

Build your own MongoDB or Create cluster with MongoDB Atlas & Get your MongoDB's URI

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

jwtToken & jwtExpirationTime

jwtToken doesn't matter what word it is! However, please be careful not to space out! And jwtExpirationTime means the time the JWT token expires, and Open-Set-Go is using 18000 by default! (Units are ms!)

JWT(JSON Web Token)
JWT is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.

mailUser & mailPass

Open-Set-Go sends you a mail when you first create a repository! Also, in order to send mail, you need the address of the mail and the app password to send!

Gmail App Password
An app password is a 16-digit passcode that gives a less secure app or device permission to access your Google Account. App passwords can only be used with accounts that have 2-Step Verification turned on.


making with bash

Generate .env files(client & server) easily with env.sh

sudo bash env.sh

making with .env

client

REACT_APP_CLIENT_ID=$clientID
REACT_APP_REDIRECT_URL=http://localhost:3000/login # this must be same with your OAuth's redirect URL
REACT_APP_SERVER_URL=http://localhost:8080 # your server's URL
RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false # env for recoil

REACT_APP_CLIENT_ID
Details at ClientID & ClientSecret

REACT_APP_REDIRECT_URL
Details at ClientID & ClientSecret

REACT_APP_SERVER_URL
Use your server IP, default is http://localhost:8080!

RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED
Related to recoil!

server

MONGODB_URI=$mongodbURI
CLIENT_ID=$clientID
CLIENT_SECRET=$clientSecret
JWT_SECRET=$jwtToken
JWT_EXPIRATION_TIME=$jwtExpirationTime
MAIL_USER=$mailUser
MAIL_PASS=$mailPass
ORIGIN=http://localhost:3000

MONGODB_URI
Details at MongodbURI

CLIENT_ID
Details at ClientID & ClientSecret

CLIENT_SECRET
Details at ClientID & ClientSecret

JWT_SECRET
Details at jwtSecret & jwtExpirationTime

JWT_EXPIRATION_TIME
Details at jwtSecret & jwtExpirationTime

MAIL_USER
Details at mailUser & mailPass

MAIL_PASS
Details at mailUser & mailPass

ORIGIN
ORIGIN is an environmental variable to prevent CORS policy problems. You can create the IP of the client to use the server. Default is http://localhost:3000.