The Core Building Block handles core functions for the Rokwire platform - users, accounts, profiles, applications, organizations, configurations, authentication, and authorization.
The service is based on clear hexagonal architecture. The hexagonal architecture divides the system into several loosely-coupled components, such as the application core and different adapters. We categorize the adapters in two categories - driver and driven.
This is the core component of the service. It keeps the data model and the logic of the service. It communicates with the outer world via adapters.
What the service provides - user interface, rest adapter, test agent etc.
What the service depends on - database, mock database, integration with other services etc.
The functionality provided by this application is documented in the Wiki.
The API documentation is available here: https://api.rokwire.illinois.edu/core/doc/ui/index.html
MongoDB v4.2.2+
Go v1.22+
The following Environment variables are supported. The service will not start unless those marked as Required are supplied.
Name | Format | Required | Description |
---|---|---|---|
ROKWIRE_CORE_LOG_LEVEL | < string > | no | Logging level to be printed to the console. Options are Info, Debug, Warn, and Error. Defaults to Info. |
ROKWIRE_CORE_ENVIRONMENT | < string > | yes | Environment in which this application is being run. |
ROKWIRE_CORE_PORT | < int > | no | Port to be used by this application. Defaults to 80. |
ROKWIRE_CORE_HOST | < string > | yes | URL where this application is being hosted. |
ROKWIRE_CORE_MONGO_AUTH | <mongodb://USER:PASSWORD@HOST:PORT/DATABASE NAME> | yes | MongoDB authentication string. The user must have read/write privileges. |
ROKWIRE_CORE_MONGO_DATABASE | < string > | yes | MongoDB database name. |
ROKWIRE_CORE_MONGO_TIMEOUT | < int > | no | Timeout for connection attempts to MongoDB in milliseconds. Defaults to 500. |
ROKWIRE_CORE_AUTH_TWILIO_ACCOUNT_SID | < string > | no | Twilio Account SID. Twilio phone authentication will not work without this variable. |
ROKWIRE_CORE_AUTH_TWILIO_TOKEN | < string > | no | Secret token needed to access Twilio APIs. Twilio phone authentication will not work without this variable. |
ROKWIRE_CORE_AUTH_TWILIO_SERVICE_SID | < string > | no | Twilio Service SID for the phone verification service. Twilio phone authentication will not work without this variable. |
ROKWIRE_CORE_SMTP_HOST | < string > | no | Host address of the SMTP server. Email verification will not work without this variable. |
ROKWIRE_CORE_SMTP_PORT | < int > | no | Port used to send emails through the SMTP server. Email verification will not work without this variable. |
ROKWIRE_CORE_SMTP_USER | < string > | no | Username for the user on the SMTP server. Email verification will not work without this variable. |
ROKWIRE_CORE_SMTP_PASSWORD | < string > | no | Password for the user on the SMTP server. Email verification will not work without this variable. |
ROKWIRE_CORE_SMTP_EMAIL_FROM | < string > | no | "From" email address to be used when sending emails. Email verification will not work without this variable. |
ROKWIRE_CORE_AUTH_PRIV_KEY | < string > | yes | PEM encoded private key for auth service keypair. Not required if ROKWIRE_CORE_AUTH_PRIV_KEY_PATH is set. |
ROKWIRE_CORE_AUTH_PRIV_KEY_PATH | < string > | yes | Path to file containing PEM encoded private key for auth service keypair. Not required if ROKWIRE_CORE_AUTH_PRIV_KEY is set. |
ROKWIRE_CORE_MIN_TOKEN_EXP | < int > | no | Minimum duration of access tokens to be allowed in minutes. Defaults to 5. |
ROKWIRE_CORE_MAX_TOKEN_EXP | < int > | no | Maximum duration of access tokens to be allowed in minutes. Defaults to 60. |
ROKWIRE_CORE_MIGRATE_PROFILES | < bool > | no | Boolean value indicating whether profiles should be migrated from the Profile Building Block. Defaults to false. |
ROKWIRE_CORE_PROFILE_BB_HOST | < string > | no | Profile Building Block host URL |
ROKWIRE_CORE_PROFILE_BB_API_KEY | < string > | no | Internal API key for accessing the Profile Building Block |
ROKWIRE_CORE_SYSTEM_APP_TYPE_IDENTIFIER | < string > | yes | Identifier for system admin application type. This should be the application or bundle identifier for Android/iOS respectively. Only required for first run. |
ROKWIRE_CORE_SYSTEM_APP_TYPE_NAME | < string > | yes | Name for system admin application type. Only required for first run. |
ROKWIRE_CORE_SYSTEM_API_KEY | < string > | yes | API key for system admin application. Only required for first run. |
ROKWIRE_CORE_SYSTEM_ACCOUNT_EMAIL | < string > | yes | Email address for initial system admin account. Only required for first run. |
ROKWIRE_CORE_SYSTEM_ACCOUNT_PASSWORD | < string > | yes | Password for initial system admin account. Only required for first run. |
ROKWIRE_CORE_BASE_SERVER_URL | < string > | false | URL of base server which overrides all of the servers listed in the docs. |
ROKWIRE_CORE_PRODUCTION_SERVER_URL | < string > | false | URL of base server which overrides the production server listed in the docs. |
ROKWIRE_CORE_TEST_SERVER_URL | < string > | false | URL of base server which overrides the test server listed in the docs. |
ROKWIRE_CORE_DEVELOPMENT_SERVER_URL | < string > | false | URL of base server which overrides the development server listed in the docs. |
USER_AGGREGATE_MINIMUM | < int > | false | value retuned if a service has limited permission and count is less than this value. |
-
Clone the repo (outside GOPATH)
-
Open the terminal and go to the root folder
-
Make the project
$ make
...
▶ building executable(s)… 1.9.0 2020-08-13T10:00:00+0300
-
Set environment variables
-
Run the executable
$ ./bin/health
-
Clone the repo (outside GOPATH)
-
Open the terminal and go to the root folder
-
Create Docker image
docker build -t core .
-
Create env.list file containing the environment variables
-
Run as Docker container
docker run --env-file env.list -p 80:80 core
$ make tests
$ make cover
$ make lint
$ make checkfmt
$ make fixfmt
$ make clean
$ make help
To run this command, you will need to install swagger-cli
$ make oapi-gen-docs
To run this command, you will need to install oapi-codegen
$ make make oapi-gen-types
Verify the service is running as calling the get version API.
curl -X GET -i http://localhost/core/version
Response
0.0.0
If you would like to contribute to this project, please be sure to read the Contributing Guidelines, Code of Conduct, and Conventions before beginning.
This repository is configured with a pre-commit hook that runs Yelp's Detect Secrets. If you intend to contribute directly to this repository, you must install pre-commit on your local machine to ensure that no secrets are pushed accidentally.
# Install software
$ git pull # Pull in pre-commit configuration & baseline
$ pip install pre-commit
$ pre-commit install
Follow the steps below to stay up to date with the associated version of this service. Note that the steps for each version are cumulative, so if you are attempting update applications that were using a version of this service which is now multiple versions out of date, be sure to make the changes described for each version between the version your application was using and the latest.
- Any
Permission
may now be added to or removed from anAccount
,AppOrgRole
, orAppOrgGroup
if at least one of its assigner permissions is satisfied by the assigning user. Any application that computes whether a given user will be allowed to modify permissions in anAccount
,AppOrgRole
orAppOrgGroup
before sending the request to do so will need to be updated for accuracy.