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:


Server Configuration

The project has an embedded and configured Tomcat server available so all you have to do is change the settings to fit what you need. The config to edit is your beapi_server.yml file in your ~/.beapi directory.

What You Have To Change...

Don't be intimidated! There are only a couple of things that have to be changed and configured here:

  • serverURL: You MUST add the PORT number or this will cause failures! There will be three instances of this variable (marked with #changeit): one for your test, development and production environments. You will need to enter a url for each. If you do not have a URL for your test/development, you can fake it by adding a fake FQDN in your /etc/hosts file (see below)
  • SSL: For test and development, you will need a self-signed keystore (for production you need a real SSL cert). To generate a self-signed keystore, use the following:
    keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass yabbadabbadoo -validity 360 -keysize 2048

    You will then be asked a series of questions, you can just hit return and use the defaults (usually empty) but make sure to set the domain name to the fully qualified domain name (FQDN)a> used in 'serverUrl'.

    This will create a 'keystore.jks' which you can store in 'yourhomedirectory/.ssh' to use with 'ssl/keyStore' in the config. If you have additional questions on created a keystore, they can be answered here.


Fake FQDN

If you are on a local test/development machine and need a FQDN (fully qualified domain name), they are very easy to fake. Just go into your '/etc/hosts' file on your local machine and add an entry like the following:

127.0.0.1       test.yourdomain.com

Database Configuration

First the project needs MariaDB/MySQL installed. You can change this in your build.gradle file and your ~/.beapi/beapi_db.yml files if you know what you are doing but for now we will stick with a default install for the project.

You will first need to edit your beapi_db.yml file in your ~/.beapi directory

What You Have To Change...

Don't be intimidated! There are only a couple of things that have to be changed and configured here:

  • url: There will be three instances of this variable (marked with #changeit): one for your test, development and production environments. You will need to enter a url with your database for each. First you will need to create a database and we will show you how to do that below.
  • username: There will be three instances of this variable : one for your test, development and production environments. You will need to enter the username/password for your database. First you will need to create a database and we will show you how to do that below.
  • password: There will be three instances of this variable : one for your test, development and production environments. You will need to enter the username/password for your database. First you will need to create a database and we will show you how to do that below.

Initializing Your Database

If you have not installed your database yet, do the following first:

sudo apt install mariadb-server

The run the following command and follow all prompts:

sudo mysql_secure_installation

Once that is complete, log in to your server and create your database and grant privileges to it. The default database name is 'beapi':

create database beapi;
use mysql;
GRANT ALL PRIVILEGES ON beapi.* to your_username@'localhost' IDENTIFIED BY 'your_password';
flush privileges;

                      


API Configuration

Once you have created your project, you will need to edit your beapi_server.yml file in your ~/.beapi directory.

What You Have To Change...

Don't be intimidated! There are only a couple of things that have to be changed and configured here:

  • login: This will be used in testing and will provide a default user for you to login to the application with.
  • password: This will be used in testing and will provide a default user for you to login to the application with.
  • email: NOTE:This can be a fake email; it just has to be a valid domain name. This will be used in testing and will provide a default user for you to login to the application with.