A simple interface to let you topup mobile load to multiple phone numbers concurrently using Goroutines.
- Build the image:
$ docker build -t pvsune/loadcentral-admin .
- Fill up required environment variables in
.env
.
APP_AUTH_USERNAME
APP_AUTH_PASSWORD
- User credentials is not necessary to save to DB yet.APP_AUTH_KEY
- JWT key used for signing the token.APP_AUTH_COOKIEDOMAIN
- Set to localhost for development.APP_LC_USERNAME
APP_LC_PASSWORD
- LoadCentral credentials.APP_AUTH_SECURECOOKIE
- Avoid XSS; Set to false for development.
- Start the app:
$ docker run --rm --env-file .env -p 8000:8000 pvsune/loadcentral-admin
- Alternatively, you can run the app directly and export environment variables.
$ go get .
$ go run main.go
There's no need to use DB yet; the user credentials are set by environment variables. When the user logins, the app generates a JWT token and save it to cookie. Cookie settings are set to avoid CSRF, XSS. The token will expire for one hour and the user needs to login again.
Each (PhoneNumber, Pcode)
is posted to LoadCentral API using its own Goroutine. The response is sent back to main program using channels and finally sent to templates for display (duhh).
- Maybe good idea to setup proper CSRF token and not rely on
Set-Cookie: <cookie-name>=<cookie-value>; SameSite=Strict
response header. - Send email for every topup request.
- Use sentry free tier to send app logs.