- Package:
mvn clean package
(build and package frontend and server module) - Go to
server
directory - Docker build: run
mvn docker:build -DskipTests
(build docker image named MT) - Start docker:
mvn docker:start
(This will start docker MT and postgresql MTDB) - Logs:
mvn docker:logs -Ddocker.follow
- To stop and remove:
mvn docker:stop
(This will stop and remove both containers)
Alternatively, run restart.sh
. It will rebuild the package and redeploy to docker containers.
DEV mode is enabled when both MT_AZURE_KEY and GOOGLE_APPLICATION_CREDENTIALS are not present in environment variable. You can also enable it by passing a non-empty DEV_BACKEND environment variable to the running instance. Once enabled and requested, the service will not use any paid service backend but will return wrapped string: 'translated[网 string 网]'.
List of Environment variables that are used in the application.
Subscription key for MS translators
Location to the Google service account credential json file
Url for CORS access control. Http response will include Access-Control-Allow-Origin
in the header to cross-browser access.
Enable dev backend for testing.
Header fields that are used for authentication:
If the instance starts with an empty account table in the database e.g. first load, it will display
a random hash as initial password in the server log. The value of the hash will also be
written to ~/magpie_initial_password
.
You can then authenticate to the REST api by setting X-Auth-User
to admin
and X-Auth-Token
to the hash noted above. This credential is considered to have admin role.
This can only be used for creating admin account (currently a BETA feature).
POST /api/account
// payload
{
"name": "John Smith",
"email": "[email protected]",
"accountType": "Normal",
"roles": ["admin"],
"username": "devID",
"password": ["d", "e", "v", "K", "E", "Y"]
}
Once an admin account is created, the initial password is no longer valid.
GET /api/account
Any other REST api can be accessed by an authenticated account regardless role (for now)