This service is built using Node.js, and can be executed either natively or using Docker, each of which has its own set of requirements.
Native execution requires:
Execution using Docker requires:
Start by cloning the repository from github to your execution environment
git clone https://github.com/gfw-api/salesforce-connector.git && cd salesforce-connector
After that, follow one of the instructions below:
1 - Set up your environment variables. Check this section of the documentation for a description on the supported (and required) environment variables. Please note that native execution will NOT automatically load .env
or dev.env
files, so you need to use another way to define those values.
2 - Install node dependencies using Yarn:
yarn install
3 - Start the application server:
yarn start
Alternatively, you can use yarn watch
to start a development server with hot-reloading. This means that every time you save a file, the TS server will be reloaded automatically.
The Salesforce connector service API should now be up and accessible in http://localhost:9050 (assuming the default settings).
1 - Create and complete your dev.env
file with your configuration. The meaning of the variables is available in this section.
2 - Execute the following command to run Salesforce connector service API:
./salesforce-connector.sh develop
3 - It's recommended to add the following line to your /etc/hosts
(if you are in Windows, the hosts file is located in c:\Windows\System32\Drivers\etc\hosts
and you'll need to 'Run as administrator' your editor):
mymachine <yourIP>
The Salesforce connector API should now be up and accessible in http://mymachine:9050 (assuming the default settings).
There are two ways to run the included tests:
Follow the instruction above for setting up the runtime environment for native execution, then run:
yarn test
Follow the instruction above for setting up the runtime environment for Docker execution, then run:
./salesforce-connector.sh test
Core Variables
- SALESFORCE_URL => The URL of the Salesforce instance that should be used. Required.
- SALESFORCE_USERNAME => The username that should be used to authenticate in Salesforce. Required.
- SALESFORCE_PASSWORD => A combination of password and security token for the username provided. Required.
- PORT => The port where the SF connector service listens for requests. Defaults to 9050 when not set.
- NODE_ENV => Environment variable of nodejs. Required.
- NODE_PATH => Required value. Always set it to 'app/src'.
For a full list of accepted environment variables, check out this file.
- Fork it!
- Create a feature branch:
git checkout -b feature/my-new-feature
- Commit your changes:
git commit -am 'Added some new feature'
- Push the commit to the branch:
git push origin feature/my-new-feature
- Submit a pull request :D