personal_page_storage_golang

command module
v0.0.0-...-9b7b450 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

README

Personal Page Storage - GoLang

Golang Api service made with Gin Gonic framework and connecto to Amazon S3 service

Table of Contents

Overview

This is a simple API to list, upload (create and update), and delete all types of files in AWS S3 service. The service is very transparent, with littles setting could be connect to another object storage.

The response elements are maded thinking in the availability of get the download link easily.

This app validate the authorization token provide in Authorization header.

API Description

For more information about the endpoints of the API please check the apiary doc.

Clone

git clone https://github.com/Javier-Caballero-Info/personal_page_storage_golang.git
git remote rm origin
git remote add origin <your-git-path>

Requirements

  • GoLang: 1.8 or above

Installation

  1. GoLang
    • Debian / Ubuntu

      • Ubuntu 16.04

        sudo add-apt-repository ppa:longsleep/golang-backports
        
        sudo apt-get update
        sudo apt-get install golang-go
        
      • Ubuntu 16.10 or above

        sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
        
        sudo apt update
        sudo apt install golang
        
      • Snap

        snap install --classic go
        
    • MacOS

      • Pkg installer

        curl -o go.pkg https://dl.google.com/go/go1.10.darwin-amd64.pkg
        shasum -a 256 go.pkg | grep 57510c51cb1f355f6723ac6bd7d9dd03facad474cbdb806db6ea2b616435dfdf
        sudo open go.pkg
        
        export PATH=$PATH:$GOPATH/bin
        
      • Brew

        brew install go
        
    • Windows

Environment

Export the following environment variables:

PORT=3000
JWT_SIGN_ALGORITHM=HS256 # Signature to validate the JWT token
JWT_SECRET_KEY=secret # Secret key for jwt

# AWS Credentials
AWS_REGION=us-east-1 # S3 region for the bucket
AWS_BUCKET=bucket_name # S3 bucket
AWS_BASE_PATH=secret # Path for subfolder inner the bucket, leave empty for root
AWS_ACCESS_KEY_ID=key_abc123 # Access key ID
AWS_SECRET_ACCESS_KEY=secret_abc123 # Secret access key

Developing

Setup the environment variables

After every change in the code you must stop the server and build the app again.

go run server.go

Test

Only manual test, for now

Build

go build server.go

Running with Docker

To run the server on a Docker container, please execute the following from the root directory:

Building the image
docker build -t personal_page_storage_golang .
Starting up a container
docker run -p 3000:3000 -d \
-e JWT_SECRET_KEY="jwt-secret-string" \
-e JWT_SIGN_ALGORITHM="HS256" \
-e AWS_REGION="us-east-1" \
-e AWS_BUCKET="bucket_name" \
-e AWS_BASE_PATH="secret" \
-e AWS_ACCESS_KEY_ID="key_abc123" \
-e AWS_SECRET_ACCESS_KEY="secret_abc123" \
personal_page_storage_golang

Contributing

Contributions welcome! See the Contributing Guide.

Author

Created and maintained by Javier Hernán Caballero García).

License

GNU General Public License v3.0

See LICENSE

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL