The Consent2Share User Interface (c2s-ui) is a generic user interface component of the Consent2share (C2S) application. Patients can use this application to manage his or her consents and providers electronically.
There are two main modules in this project:
client
: This folder contains all frontend user interface code, which is written using Angular v2.4.server
: This folder contains a Spring Boot project, which is primarily responsible for packaging and serving the static resources that are built from the client
module. This is also an Apache Maven project which utilizes Frontend Maven Plugin to:
client
module Node.js dependencies; client
module using Node Package Manager NPM Node.js package. Finally, it uses Apache Maven Resources Plugin to copy the resources that are built from the client
module into the server
module that will be eventually packaged as a build artifact in jar
format. Therefore, there is no need to install Node.js globally if server
module is built with Maven.This Maven project requires Apache Maven 3.3.3 or greater to build it. It is recommended to use the Maven Wrapper scripts provided with this project. Maven Wrapper requires an internet connection to download Maven and project dependencies for the very first build.
To build the project, navigate to the folder that contains pom.xml
file using the terminal/command line.
mvnw.cmd clean install
mvnw clean install
bhitsdev/c2s-ui:latest
tag):
mvnw.cmd clean package docker:build
mvnw clean package docker:build
Note: Frontend developers can build client
and server
modules separately and save build time by using Angular CLI. This option requires Angular CLI to be installed globally.
client
module: run npm run prod
in the client folderjar
file from the server
module This is a Spring Boot project and serves the project via an embedded Tomcat instance. Therefore there is no need for a separate application server to run it.
java -jar c2s-ui-x.x.x-SNAPSHOT.jar <additional program arguments>
docker run -d bhitsdev/c2s-ui:latest <additional program arguments>
NOTE: In order for this project to fully function as a microservice in the Consent2Share application, it is required to setup the dependency microservices and the support level infrastructure. Please refer to the Consent2Share Deployment Guide in the corresponding Consent2Share release (see Consent2Share Releases Page) for instructions to setup the Consent2Share infrastructure.
During build, Angular-Cli uses Webpack to create bundles (Javascript files) which will be referenced in the browser. Run the application and use browser development tools to set breakpoints in related Javascript files to start debugging.
The server
module runs with some default configuration that is primarily targeted for development environment. It utilizes Configuration Server
which is based on Spring Cloud Config to manage externalized configuration, which is stored in a Configuration Data Git Repository
. We provide a Default Configuration Data Git Repository
.
This API can run with the default configuration, which is targeted for a local development environment. Default configuration data is from three places: bootstrap.yml
, application.yml
, and the data which Configuration Server
reads from Configuration Data Git Repository
. Both bootstrap.yml
and application.yml
files are located in the resources
folder of this source code.
We recommend overriding the configuration as needed in the Configuration Data Git Repository
, which is used by the Configuration Server
.
Also, please refer to Spring Cloud Config Documentation to see how the config server works, Spring Boot Externalized Configuration documentation to see how Spring Boot applies the order to load the properties, and Spring Boot Common Properties documentation to see the common properties used by Spring Boot.
java -jar c2s-ui-x.x.x-SNAPSHOT.jar --c2s.c2s-ui.oauth2.client.secret=strongpassword
NOTE: The oauth2.client.client-id
and oauth2.client.secret
value are used for User Account and Authentication (UAA) Password Grant type. The configuration uses the format client_id:client_secret
to be Base 64 encoded. The client_id
refers to the OAuth2 Client ID assigned to the Consent2Share UI by UAA. C2S uses c2s-ui
as the default client_id
for this application.
docker run -d bhitsdev/c2s-ui:latest --c2s.c2s-ui.oauth2.client.secret=strongpassword
In a docker-compose.yml
, this can be provided as:
version: '2'
services:
...
c2s-ui.c2s.com:
image: "bhitsdev/c2s-ui:latest"
command: ["--c2s.c2s-ui.oauth2.client.secret=strongpassword"]
...
For simplicity in development and testing environments, SSL is NOT enabled by default configuration. SSL can easily be enabled following the examples below:
java -jar c2s-ui-x.x.x-SNAPSHOT.jar --spring.profiles.active=ssl --server.ssl.key-store=/path/to/ssl_keystore.keystore --server.ssl.key-store-password=strongkeystorepassword
docker run -d -v "/path/on/dockerhost/ssl_keystore.keystore:/path/to/ssl_keystore.keystore" bhits-dev/c2s-ui:latest --spring.profiles.active=ssl --server.ssl.key-store=/path/to/ssl_keystore.keystore --server.ssl.key-store-password=strongkeystorepassword
docker-compose.yml
, this can be provided as:
...
c2s-ui.c2s.com:
image: "bhits-dev/c2s-ui:latest"
command: ["--spring.profiles.active=ssl","--server.ssl.key-store=/path/to/ssl_keystore.keystore", "--server.ssl.key-store-password=strongkeystorepassword"]
volumes:
- /path/on/dockerhost/ssl_keystore.keystore:/path/to/ssl_keystore.keystore
...
NOTE: As seen in the examples above, /path/to/ssl_keystore.keystore
is made available to the container via a volume mounted from the Docker host running this container.
Java has a default CA Certificates Store that allows it to trust well-known certificate authorities. For development and testing purposes, one might want to trust additional self-signed certificates. In order to override the default Java CA Certificates Store in Docker container, one can mount a custom cacerts
file over the default one in the Docker image as follows: docker run -d -v "/path/on/dockerhost/to/custom/cacerts:/etc/ssl/certs/java/cacerts" bhits-dev/c2s-ui:latest
NOTE: The cacerts
references given regarding volume mapping above are files, not directories.
Consent2Share provide support for Internationalization (i18n) in English and Spanish. English is the default language and is fully supported but for Spanish, the translation still need to be completed.
If you have any questions, comments, or concerns please see Consent2Share project site.
Please use GitHub Issues page to report issues.