Skip to content

cl2871/File-Storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Storage Application

This file storage application allows files to be stored with cloud services such as Amazon Web Services's S3 or Google Cloud Platform's storage service. This application is designed to handle the file storage needs of a service/team rather than multiple users.

This application uses Spring's Service Locator Pattern to choose between the AWS S3 and GCP services at runtime based on request arguments.

Getting Started

These instructions will help you get the project up and running on your local machine for development and testing purposes.

Prerequisites

Please have Java 8 installed to run this application. Additionally, it is recommended to have maven installed, but a maven wrapper is included (to use the wrapper use ./mvnw instead of mvn for commands)

Additionally, familiarity with AWS and GCP is required. An AWS S3 bucket and a GCP Cloud Storage bucket will need to be set up prior to running this application.

Knowledge of Java and the Spring Framework will help with navigating and understanding the project.

Setup

Before running the application, please set up the following environment variables:

  • AWS_ACCESS_KEY - AWS access key ID, e.g. ABCDEFGHIJKLMNOPQRST
  • AWS_SECRET_KEY - AWS secret access key, e.g. 0123456789ABCDEFGHIJ0123456789
  • GCP_PROJECT_ID - GCP project id, e.g. sample-project-123456
  • GCP_CREDENTIALS_LOCATION - local location of the JSON file, e.g. file:/Users/Chris/Desktop/Sample-Project-123456789123.json

For more information regarding the environment variables, refer to the project's application.properties file.

For setup with the cloud providers, refer to the following links:

Running the application

To run the application, execute the following commands on the command line.

# Run the Application
mvn spring-boot:run

To access a file, you can go to the following URL.

GET: http://localhost:8080/api/fileStorage/storageProvider/GCP/storageLocation/my_test_bucket/fileName/Example.jpg

Note: make sure your credentials allow you to access that bucket.

To upload a file, you can make a POST request.

POST: http://localhost:8080/api/fileStorage/storageProvider/GCP/storageLocation/sc_test_bucket

Body: form-data
	- key: file, value: Example.jpg

For all the requests you can make to this application, please see Requests.

Running the tests

You can use maven to run tests.

# If any changes are made, clean the project directory first
mvn clean

# Run tests
mvn test

Deployment

TODO: Add additional notes about how to deploy this on a live system

Built With

  • Spring - Spring Framework and Spring Boot used to build this web application
  • Maven - Dependency Management

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

About

Simple file storage application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages