# VIR-Backend

### Instructions

*Make sure that JAVA is installed
*Set up an environmental variable called "APP_ENCRYPTION_PASSWORD". (the key is kept secret, guarded in a vault)
*Set up an environmental variable called "SENDGRID_API_KEY". This is used for sending emails
NOTE: as of Fall 2022, the SENDGRID_API_KEY has been lost for over a year and we can not find a reason it was ever even needed.
*Set up an environmental variable called "PROD" and set the value to 0. This is used by the application to determine whether or not emails can be sent (in production only, but this can be modified for debugging/testing. It's not even necessary to have as "1" for integration tests because the library will just make the REST calls to make sure it can connect. So unless needed just set this to "0")

Install Tesseract for your system. https://github.com/tesseract-ocr/tesseract/wiki
* Create an environment variable TESSERACT_PATH pointing to your installation directory. Where the executable is.
* Create an environment variable TESSDATA_PREFIX poiting to the directory above the 'tessdata' one; should be in your installation directory but it can be downloaded from the web.

*To Build:
```
./mvnw build (mvnw.cmd for Windows)
```
You should get a "Build Success" at the end of the process.

VIR-Backend\bundle\.ebextensions\nginx\conf.d\proxy.conf has an important configuration setting that lets files above 1mb get uploaded.

# Folder structure information

## Tree
```
.
├── .gitignore
├── .mvn
│   └── wrapper
│       ├── maven-wrapper.jar
│       └── maven-wrapper.properties
├── .project
├── .settings
├── README.md
├── bundle
│   ├── .ebextensions
│   │   ├── env.config
│   │   └── nginx
│   ├── Procfile\
│   └── VIR-Backend-0.0.29-SNAPSHOT.jar
├── mvnw
├── mvnw.cmd
├── pom.xml
├── release
│   ├── .gitkeep
│   ├── bundle-VIR-Backend-0.0.28-SNAPSHOT.zip
│   └── bundle-VIR-Backend-0.0.29-SNAPSHOT.zip
├── src
│   ├── main
│   │   ├── java
│   │   └── resources
│   └── test
│       ├── java
│       └── resources
├── target
```

## Description
I am only describing the most important files and folders here. If there is something that's not clear use your best friend in the hole wolrd 'Google' 

Folder/File | Description
--- | --- 
Code                | Contains all the code for the application.
.mvn                | A maven folder
.project            | A project setting folder for Eclipse.
.settings           | A project setting folder for Eclipse.
.README.md          | This readme file (talking about recursion...)
bundle              | This is a very important folder. All resources have to be deployed to AWS in a bundle. Inside it contains configurations and settings needed.<br/><b>.ebextensions</b> : Folder contains all custom settings for the app <br/><b>Procfile</b> : Contails instructions on how to run the applicaton on the cloud. Note that this file is generated by maven, so any manual change will be discarted. If you need to modify it make the appropriate change in the 'pom.xml' file. <br/><b>VIR-Backend-0.0.29-SNAPSHOT.jar</b> : Jar file generated by Maven.
mvnw                | File needed for the maven wrapper. (safely ignore, but not delete)
mvnw.cmd            | File needed for the maven wrapper. (safely ignore, but not delete)
pom.xml             | Maven file that contains all the configurations, dependencies management, and build instructions for the project.
release             | Folder that contains all final realease files. It will be incrementally creatted when the command 'build.sh prod' is run from the 'Code' folder.
src                 | Source folder for the java project. It contains the main and the test resources.
target              | Regular file for Maven all compiled files will be here.
