Merge pull request 'fix/flags_and_build' (#4) from fix/flags_and_build into main

Reviewed-on: #4
This commit is contained in:
Thomas Andrade 2022-05-18 11:43:49 +00:00
commit 22ec82a326
4 changed files with 44 additions and 2 deletions

21
.github/workflows/build-on-branch.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Build tag
on:
push:
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: docker build . -t tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec))
- name: Login
uses: docker/login-action@v1.10.0
with:
username: tandrade
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push
run: docker push tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec))

21
.github/workflows/build-on-tag.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Build tag
on:
create:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: docker build . -t tandrade/short:${GITHUB_REF/refs\/tags\//}
- name: Login
uses: docker/login-action@v1.10.0
with:
username: tandrade
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push
run: docker push tandrade/short:${GITHUB_REF/refs\/tags\//}

View File

@ -2,7 +2,7 @@ FROM golang:1.18 as builder
ENV CGO_ENABLED=0
ADD main.go go.* /go/src/short/
COPY . /go/src/short/
WORKDIR /go/src/short

View File

@ -64,7 +64,7 @@ func main() {
addr = flag.String("addr", "localhost", "Address to listen for connections")
domain = flag.String("domain", "localhost", "Domain to write to the URLs")
path = flag.String("path", "", "Path to the base URL (https://localhost/PATH/...")
http = flag.Bool("http", true, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https")
http = flag.Bool("http", false, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https")
port = flag.Int("port", 8080, "Port to listen for connections")
exp = flag.Int("exp", 240, "Default expiration time in hours, default 240")
cleanup = flag.Int("cleanup", 1, "Cleanup interval in hours, default 1")