golang-upload-api

command module
v0.0.0-...-7659e5b Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

Upload de Medias

This service aims to upload medias (images, documents, videos and audios...) to the main cloud storages (aws s3, google storage, digital ocean spaces, cloudinary...). Like a media center

Class diagram

Sequence diagram

How to configure providers

A short description to confgure storage providers

Digital Ocean

Create Token

Then create a space

After that fill the env vars

DO_SPACE_ENDPOINT=BUCKET_ENDPOINT
; check your region in the endpoint url
DO_SPACE_REGION='sfo2'
DO_SPACE_NAME=DO_SPACE_NAME
DO_ACCESS_KEY=YOUR_SPACE_ACCESS_KEY
DO_SECRET_KEY=YOUR_SPACE_SECRET_KEY
GCP

Create service account with role cloud storage: admin objects

Then generate the credential and save it on your computer

Create a bucket with public access and add allUsers permissions for get objects

After that fill the env vars

GOOGLE_APPLICATION_CREDENTIALS=YOUR_CREDENTIALS_PATH
GOOGLE_BUCKET_NAME=YOUR_BUCKET_NAME

Development

Locally, I recommend ubuntu or debian linux:

  1. Golang v1.19
  2. Git
  3. Docker
  4. Runs go mod tidy
  5. Copy the .env.sample and create the .env file with your credentials

then runs:

go run main http

Docker:

  1. Install Docker
  2. Install Docker compose

and all you need to run is ...

$ docker-compose up http

Testing

For test your application you need to run docker-compose run --rm test and this command will use the correctly environment

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Jump to

Keyboard shortcuts

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