Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pvsune/loadcentral-admin
A simple interface to let you topup mobile load to multiple phone numbers concurrently using Goroutines.
https://github.com/pvsune/loadcentral-admin
gin-gonic gin-jwt golang jwt topup
Last synced: about 1 month ago
JSON representation
A simple interface to let you topup mobile load to multiple phone numbers concurrently using Goroutines.
- Host: GitHub
- URL: https://github.com/pvsune/loadcentral-admin
- Owner: pvsune
- Created: 2020-06-03T02:21:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T03:52:55.000Z (over 4 years ago)
- Last Synced: 2024-11-16T15:38:30.757Z (about 2 months ago)
- Topics: gin-gonic, gin-jwt, golang, jwt, topup
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LoadCentral Admin
A simple interface to let you topup mobile load to multiple phone numbers concurrently using Goroutines.## Quickstart
1. Build the image:
```
$ docker build -t pvsune/loadcentral-admin .
```2. 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.
3. Start the app:
```
$ docker run --rm --env-file .env -p 8000:8000 pvsune/loadcentral-admin
```4. Alternatively, you can run the app directly and export environment variables.
```
$ go get .
$ go run main.go
```## How it works
### Authentication
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.### Load topup
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).## Notes
1. Maybe good idea to setup proper CSRF token and not rely on `Set-Cookie: =; SameSite=Strict` response header.
2. Send email for every topup request.
3. Use sentry free tier to send app logs.