BeAPI Framework Configuration
Once you have completed installation, you will next need to configure your environment. Follow these configuration steps in order to get your environment setup and working:
Application Properties
in your 'src/main/resources' directory, you will find your application.properties file. The following stats are what you are most concerned with changing:
-
- application.components This should be the base path for ALL components in your application
- application.repository This is the base path for your repositories
- application.domain This is the base path for your domain objects
NOTE: These are already preconfigured in the demo project; if you create a NEW PROJECT, these will have to be changed.
Gradle Properties Settings
Since this is an API application, people will want to get into the nuts an bolts of configuring this so we also supply some of the more advanced configuration settings:
- JVM Args: Should you need to tweak the default BUILD JVM ARGS, you will find the JVM Args in the 'gradle.properties'; there is a section that looks like the following:
- configType.nano="-Xms512m -Xmx1024m -XX:+UseParallelGC -XX:ParallelGCThreads=4 -XX:MaxGCPauseMillis=200 -XX:MaxGCMinorPauseMillis=75 -server -noverify -Xshare:off -Djava.net.preferIPv4Stack=true -XX:+EliminateLocks -XX:GCTimeRatio=7 -Djava.security.egd=file:/dev/urandom -Djdk.map.althashing.threshold=512"
- configType.medium="-Xms1024m -Xmx2048m -XX:+UseParallelGC -XX:ParallelGCThreads=8 -XX:MaxGCPauseMillis=200 -XX:MaxGCMinorPauseMillis=75 -server -noverify -Xshare:off -Djava.net.preferIPv4Stack=true -XX:+EliminateLocks -XX:GCTimeRatio=7 -Djava.security.egd=file:/dev/urandom -Djdk.map.althashing.threshold=512"
- configType.large="-Xms4048m -Xmx4096m -XX:+UseParallelGC -XX:ParallelGCThreads=16 -XX:MaxGCPauseMillis=200 -XX:MaxGCMinorPauseMillis=75 -server -noverify -Xshare:off -Djava.net.preferIPv4Stack=true -XX:+EliminateLocks -XX:GCTimeRatio=7 -Djava.security.egd=file:/dev/urandom -Djdk.map.althashing.threshold=512"
- configTypeDefault=nano
You can use these default per your instance or change them to your needs. You then simply pass the 'configType' variable with the OPTION for your instance [nano/medium/large] with your 'BUILD':
gradle clean build -Pargs=configType=nano
Beapi Api Config Changes
Once you have created your project, you will need to edit your 'beapi_api.yaml' file in your ~/.boot/{env}/ directory and changes the following settings:
API
procCores: (CHANGE)
Change this to the number of processors your machine has; if running on AWS/Google/SpringCloud, this will be your HyperThreads/vCPU number.
BOOTSTRAP
You will also need to change the following. For more information about this, see the installation process.
superUser/login: (CHANGE)
Superuser that is bootstrapped with your application (also used for functional testing)superUser/password: (CHANGE)
Superuser that is bootstrapped with your application (also used for functional testing)superUser/email: (CHANGE)
Superuser that is bootstrapped with your application (also used for functional testing)testUser/login: (CHANGE)
Testuser that is bootstrapped with your application (also used for functional testing)testUser/password: (CHANGE)
Testuser that is bootstrapped with your application (also used for functional testing)testUser/email: (CHANGE)
Testuser that is bootstrapped with your application (also used for functional testing)
By Default, the beapi_api.yml file has the following settings:
API Properties | Definition | Default |
---|---|---|
attempts | Integer representing number of login failures | 5 |
procCores | Integer representing number of system cores [set to be deprecated in 0.7] | 4 |
documentationUrl | String representing documentation url | 'http://orubel.github.io/Beapi-API-Framework/' |
views | [deprecated] | ['admin','apidoc','api','login','logout'] |
reserveduris | List representing restricted URI's | ['/authenticate','/register','/error','/login','/logout'] |
publicEndpoint | List representing static endpoint in application | ['jwtAuthentication','beapiError'] |
staticEndpoint | List representing hardcoded endpoints in starter | ['apidoc','connector','properties','user','authority','hook'] |
apiServer | String representing the (protocol / FQDN or IP / port) used by server | 'http://localhost:8080' |
apichainLimit | Integer representing number of times api can be chained | 3 |
postcrement | [deprecated] | false |
chainingEnabled | Boolean representing if chaining is enabled | true |
batchingEnabled | Boolean representing if batching is enabled | true |
encoding | String representing the default encoding | UTF-8 |
iostateDir | String representing the configuration dir | '.boot/.iostate' |
serverType | String representing the server type; can be either master/slave | master |
configType | String representing the Tomcat config type; can be either nano/medium/large | large |
testingProtocol | String representing the default protocol to use when testing | http |
autoTest | Boolean representing if the app uses automated testing | false |
API/Throttle Properties | Definition | Default |
---|---|---|
active | Boolean representing if throttling is on | false |
rateLimit | Map representing roles/rate-limits | {'ROLE_USER':1000,'ROLE_ADMIN':10000} |
dataLimit | Map representing roles/data-limits | {'ROLE_USER':1000000} |
expires | Integer representing number of seconds til reset | ['admin','apidoc','api','login','logout'] |
API/Webhook Properties | Definition | Default |
---|---|---|
active | Boolean representing if webhooks are active | false |
API/Security Properties | Definition | Default |
---|---|---|
superuserRole | String representing super user role | ROLE_ADMIN |
userRole | String representing user role | ROLE_USER |
anonRole | String representing unknown user | ROLE_ANONYMOUS |
networkGroups | List representing network types | ['open','public','private'] |
networkRoles | Map representing roles associated with network types | {'open':['ROLE_ADMIN','ROLE_ANONYMOUS','ROLE_USER'],'public':['ROLE_ADMIN','ROLE_USER'],'private':['ROLE_ADMIN']} |
corsWhitelist | List representing whitelisted FQDN's and IP's for CORS | ['http://localhost','http://localhost:8080','http://127.0.0.1','http://127.0.0.1:8080'] |
API/Bootstrap Properties | Definition | Default |
---|---|---|
superUser | key/val map representing login/password/email of the super-user | N/A |
superUser | key/val map representing login/password/email of the test-user | N/A |
Beapi DB Config Changes
You will then need to edit your 'beapi_db.yaml' file in your ~/.boot/{env}/ directory and changes the following settings (for more information, see springboots information about setting up a datasource):
-
driverclassname: (CHANGE)
driver used when making a database connectionusername: (CHANGE)
database connection usernamepassword: (CHANGE)
database connection passwordurl: (CHANGE)
url for database connectionhibernate/dialect: (CHANGE)
JPA dialect