Skip to content

Commit

Permalink
Adding readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Nov 3, 2018
1 parent 55e97a0 commit 0a0bf9b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
providers/uploads/*
.idea
.idea
claudia.json
50 changes: 46 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
Form.io File Upload Server
-------------------------
This library provides an Upload Server/Proxy for use with the Form.io File Component and URL configuration.
This allows for Private file upload and downloads by sending Authentication requests to the Form.io API Server
This allows for **Private file upload and downloads** by sending Authentication requests to the Form.io API Server
to determine if a user has permissions to upload or download based on their access to either Submit the form, or fetch the Submission JSON respectively.

Getting Started
---------------------
## Getting Started
This library can be ran within 3 different environments.

1.) Locally using Node.js
Expand All @@ -19,9 +18,35 @@ In order to run this server locally, you can type the following within your term
node index

### Running within Docker
To run this with docker, you can use the following commands.

docker run -itd \
-e "PORT=4100" \
-e "MAX_UPLOAD_SIZE=16mb" \
-e "DEBUG=*" \
-e "PROVIDERS=file,alfresco" \
-e "UPLOAD_DIR=" \
-e "ALFRESCO_USER=admin" \
-e "ALFRESCO_PASS=admin" \
-e "ALFRESCO_HOST=http://127.0.0.1:8082" \
--restart unless-stopped \
--name formio-upload \
-p 4100:4100 \
formio/formio-upload

### Running within AWS Lambda
Before you can run with AWS Lambda, you must first install [Claudia](https://claudiajs.com).

npm install claudia -g

Next, you will want to configure your access credentials to the AWS CLI. You can do this by following the instructions @ [https://claudiajs.com/tutorials/installing.html](https://claudiajs.com/tutorials/installing.html)

Once you have access setup, you can now modify the deploy scripts within ```package.json``` to change where this script will be deployed. Once you have made changes to the ```deploy``` script within ```package.json```, you can now run the following to deploy this within AWS Lambda using the deploy script.

npm run deploy


#### Environment Variables.
### Environment Variables.
You must use Environment variables to configure the runtime operation of this server. When running this server locally using Node.js, you can set the Environment variables within the ```.env``` file. These variables are defined as follows.


Expand All @@ -36,3 +61,20 @@ You must use Environment variables to configure the runtime operation of this se
| ALFRESCO_PASS | When using the Alfresco provider, this is the user account password to log into the Alfresco ECM | admin |
| ALFRESCO_HOST | When using the Alfresco provider, this is the Alfresco ECM server URL | http://127.0.0.1:8082 |

## Configure Form Upload
Now that you have the server running, you can configure a Form.io Form with a new File component.

![Alt text](https://monosnap.com/image/hyuWKj6MGKMFvNXQ5Es1XqOE5M3CCc.png)

Within the configuration of this File component, you will need to set the file upload type to **URL** and then provide the URL of this service. You can decide which upload provider to use based on the path you provide to the url of the running server.

For example:

- **http://localhost:4100/file** - Uses the local file upload provider.
- **http://localhost:4100/alfresco** - Uses the Alfresco ECM upload provider.

You will also need to make sure you check **Private Download**. Your configuration should look something like the following.

![Alt text](https://monosnap.com/image/OVJ2E3kJA63xbhPlrCaKj3ecPOxsGw.png)

The upload will now function against this server.

0 comments on commit 0a0bf9b

Please sign in to comment.