Skip to content

Instantly share code, notes, and snippets.

@oivoodoo
Last active April 8, 2017 13:27
Show Gist options
  • Save oivoodoo/c93ce954c476bf8d0592ca75e83dc4dd to your computer and use it in GitHub Desktop.
Save oivoodoo/c93ce954c476bf8d0592ca75e83dc4dd to your computer and use it in GitHub Desktop.
docker-compose.yml
func init() {
var err error
client, err := minio.New("doc_gen_minio:9000", "accesss", "secret", false)
if err != nil {
panic(err)
}
err = client.MakeBucket("output", "")
if err != nil {
panic(err)
}
}
func Test_Upload(t *testing.T) {
...
}
func config() aws.Config {
return Config: &aws.Config{
Credentials: credentials.NewStaticCredentials(s3_access_key(), s3_secret_key(), ""),
Endpoint: s3_host(),
Region: s3_region(),
DisableSSL: s3_disable_ssl(),
S3ForcePathStyle: s3_force_path_style(),
}
}
func s3_access_key() string {
id := get("AWS_ACCESS_KEY_ID", "")
if id == "" {
panic("please add AWS_ACCESS_KEY_ID")
}
return id
}
func s3_secret_key() string {
id := get("AWS_SECRET_ACCESS_KEY", "")
if id == "" {
panic("please add AWS_SECRET_ACCESS_KEY")
}
return id
}
func s3_host() *string {
return aws.String(get("AWS_HOST", "s3.amazonaws.com"))
}
func s3_bucket() *string {
bucket := get("AWS_BUCKET", "")
if bucket == "" {
panic("please add AWS_BUCKET")
}
return aws.String(bucket)
}
func s3_region() *string {
return aws.String(get("AWS_REGION", "us-east-1"))
}
func s3_disable_ssl() *bool {
return aws.Bool(get("AWS_DISABLE_SSL", "false") == "true")
}
func s3_force_path_style() *bool {
return aws.Bool(get("AWS_S3_FORCE_PATH_STYLE", "false") == "true")
}
version: "3"
services:
minio:
image: minio/minio:latest
container_name: doc_gen_minio
ports: ["9000"]
environment:
MINIO_ACCESS_KEY: access
MINIO_SECRET_KEY: secret
command: server doc_gen_minio/export
networks:
- back-tier
app:
build: ./
volumes:
- ./:/app
networks:
- back-tier
ports:
- "3003:3003"
stdin_open: true
tty: true
environment:
AWS_ACCESS_KEY: "access"
AWS_SECRET_KEY: "secret"
AWS_HOST: "http://doc_gen_minio:9000"
AWS_DISABLE_SSL: "true"
AWS_S3_FORCE_PATH_STYLE: "true"
AWS_BUCKET: "output"
volumes:
db-data:
networks:
back-tier:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment