Betamocks Config
Introduction
Creating a service backend endpoint for http://va.gov is a common task for developers. Due to the complexity of integrating with legacy VA REST or SOAP applications we've developed a pattern for making these connections. This document offers the Betamocks configuration required to integrate vets-api, vets-website, and vets-api-mockdata.
1. VA Profile configuration to run Betamocks on Vets-API
config/betamocks/services_config.yml
# VA Profile / Vet360
- :name: "VA Profile"
:base_uri: <%= "#{URI(Settings.vet360.url).host}:#{URI(Settings.vet360.url).port}" %>
:endpoints:
- :method: :get
:path: "/demographics/demographics/v1/*/*"
:file_path: "vet360/demographics/default"
Modify the vets360 settings: cache_enabled: true
, enabled: true
, and mock: true
.
config/settings.yml
...
# Settings for VAProfile
vet360:
url: "https://int.vet360.va.gov"
contact_information:
cache_enabled: true
enabled: true
timeout: 30
mock: true
...
2. Add credential mocked data for a new user - Sign-in Service Login
The mocked data credentials are documented in the vets-api-mockdata README.
** Requires:
Access to username/password of test user to mock credential data for
Access to local Rails development
IDME, DSLOGON, MHV Credentials: On localhost
vets-api
, inlib/sign_in/idme/configuration.rb
, set body oflog_credential
function totrue
.
lib/sign_in/idme/configuration.rb
# Set body of log_credential function to true
def log_credential
true
end
LOGINGOV Credential: On localhost
vets-api
, inlib/sign_in/logingov/configuration.rb
, set body oflog_credential
function totrue
lib/sign_in/logingov/configuration.rb
# Set body of log_credential function to true
def log_credential
true
end
Turn off
auto_uplevel
to reduce credential compatibility issues: inconfig/settings.local.yml
, setsign_in.auto_uplevel = false
config/settings.local.yml, not settings.yml
sign_in:
auto_uplevel: false
...
Authenticate normally using Sign in Service (
http://localhost:3001/?oauth=true&next=loginModal
, then authenticate with expected credential)Mocked credential will be created in
credential
directory ofvets-api-mockdata
repositoryAt this point, credential has successfully been mocked for the given user
3. Start Rails server
$ cd ../vets-api
$ rails server
=> Booting Puma
4. Build Vets Website applications
$ cd ../vets-website
$ yarn build
yarn run v1.19.1
Help and feedback
Get help from the Platform Support Team in Slack.
Submit a feature idea to the Platform.