Skip to content

Commit

Permalink
fix: Bazarr-sync would not work with subpath addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmandourah committed Oct 12, 2024
1 parent 9924d5f commit 16a8cb0
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Create and publish a Docker image

on:
workflow_dispatch:
push:
tags:
- v*

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
go.*
**/*.go
- name: Log in to the Container registry
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}

- name: Extract metadata (tags, labels) for Docker
if: steps.changed-files.outputs.any_changed == 'true'
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
31 changes: 31 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: goreleaser

on:
workflow_dispatch:
push:
tags:
- v*

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 11 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/url"
"os"
"strings"

"github.com/spf13/viper"
)
Expand Down Expand Up @@ -42,9 +43,17 @@ func InitConfig() {
os.Exit(1)
}
viper.Unmarshal(&cfg)
var (
baseUrl string
err error
)
//this is a check in case the Address is a subpath
if strings.Contains(cfg.Address,"/") {
baseUrl, err = url.JoinPath(cfg.Protocol + "://" + cfg.Address)
}else {
baseUrl, err = url.JoinPath(cfg.Protocol + "://" + cfg.Address + ":" + cfg.Port)
}

//Bazarr url
baseUrl, err := url.JoinPath(cfg.Protocol + "://" + cfg.Address + ":" + cfg.Port)
if err != nil{
fmt.Fprintln(os.Stderr, "URL Error: ", err)
}
Expand Down

0 comments on commit 16a8cb0

Please sign in to comment.