Skip to content

Commit 116e5d7

Browse files
Merge pull request #62 from hhftechnology/traefik-int
Traefik int
2 parents 92f1362 + 0dc2d5f commit 116e5d7

File tree

17 files changed

+556
-297
lines changed

17 files changed

+556
-297
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ name: Build and Push Docker Image
33
on:
44
push:
55
branches:
6-
- main
7-
- master
8-
- dev
6+
- traefik-int
97
paths:
108
- 'Dockerfile'
119
- 'go.mod'
@@ -19,9 +17,6 @@ on:
1917
- 'models/**'
2018
- 'services/**'
2119
- 'ui/**'
22-
23-
tags:
24-
- 'v*'
2520
workflow_dispatch:
2621

2722
env:
@@ -53,57 +48,23 @@ jobs:
5348
username: ${{ secrets.DOCKERHUB_USERNAME }}
5449
password: ${{ secrets.DOCKERHUB_TOKEN }}
5550

56-
# Get current date for image tags
57-
- name: Get current date
58-
id: date
59-
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
60-
6151
# Prepare tags based on branch and version
6252
- name: Prepare Docker tags
6353
id: docker_tags
6454
run: |
6555
TAGS=""
66-
67-
# Add branch-specific tags
68-
if [[ "${{ github.ref_name }}" == "main" || "${{ github.ref_name }}" == "master" ]]; then
69-
# For main/master branch, add latest tag
70-
TAGS="$TAGS ${{ env.DOCKERHUB_IMAGE_NAME }}:latest"
71-
elif [[ "${{ github.ref_name }}" == "dev" ]]; then
72-
# For dev branch
73-
TAGS="$TAGS ${{ env.DOCKERHUB_IMAGE_NAME }}:dev"
74-
elif [[ "${{ github.ref_type }}" == "branch" ]]; then
75-
# For other branches
76-
TAGS="$TAGS ${{ env.DOCKERHUB_IMAGE_NAME }}:${{ github.ref_name }}"
77-
fi
78-
79-
# Add sha tag for all branches
80-
if [[ "${{ github.ref_type }}" == "branch" ]]; then
81-
TAGS="$TAGS,${{ env.DOCKERHUB_IMAGE_NAME }}:sha-${GITHUB_SHA::7}"
82-
fi
83-
84-
# Add version tag for tagged releases
85-
if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref }}" == refs/tags/v* ]]; then
86-
VERSION="${{ github.ref_name }}"
87-
88-
# Add full version tag
89-
TAGS="$TAGS,${{ env.DOCKERHUB_IMAGE_NAME }}:$VERSION"
56+
if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "traefik-int" ]]; then
57+
TAGS="${{ env.DOCKERHUB_IMAGE_NAME }}:traefik-int"
9058
fi
91-
92-
# Add date tag for all builds
93-
TAGS="$TAGS,${{ env.DOCKERHUB_IMAGE_NAME }}:${{ steps.date.outputs.date }}"
94-
95-
# Remove leading space or comma if present
96-
TAGS=$(echo "$TAGS" | sed 's/^[ ,]*//')
97-
9859
echo "tags=$TAGS" >> $GITHUB_OUTPUT
9960
echo "Docker tags: $TAGS"
10061
10162
- name: Build and push
10263
uses: docker/build-push-action@v5
10364
with:
10465
context: .
105-
push: true
66+
push: ${{ steps.docker_tags.outputs.tags != '' }} # IMPORTANT: Only push if tags were generated
10667
platforms: linux/amd64,linux/arm64
10768
tags: ${{ steps.docker_tags.outputs.tags }}
10869
cache-from: type=gha
109-
cache-to: type=gha,mode=max
70+
cache-to: type=gha,mode=max

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,27 @@ Switch `active_data_source` and update URLs/credentials via the **Settings** pan
395395
go run main.go
396396
# For build:
397397
# go build -o middleware-manager main.go
398+
399+
```
400+
Tip: Use this command if you need to set a hostname record in /etc/hosts for pangolin based on the internal IP for the pangolin container
401+
```
402+
docker network inspect -v pangolin
398403
```
399404

400405
### Frontend
401406

402407
```bash
403408
cd ui
404-
# If node_modules is missing: npm install (or yarn install)
405-
npm start # or yarn start
409+
cp src/package.json .
410+
npm install
411+
npm start
412+
```
413+
Note: if you are getting an error such as `options.allowedHosts[0] should be a non-empty string`
414+
415+
you should create a .env file in /ui folder. Do not do this in production (development only)
416+
417+
```sh
418+
DANGEROUSLY_DISABLE_HOST_CHECK=true
406419
```
407420

408421
## License

api/handlers/resources.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (h *ResourceHandler) GetResources(c *gin.Context) {
5555
}
5656

5757
// Use default priority if null
58-
priority := 100 // Default value
58+
priority := 200 // Default value
5959
if routerPriority.Valid {
6060
priority = int(routerPriority.Int64)
6161
}
@@ -133,7 +133,7 @@ func (h *ResourceHandler) GetResource(c *gin.Context) {
133133
}
134134

135135
// Use default priority if null
136-
priority := 100 // Default value
136+
priority := 200 // Default value
137137
if routerPriority.Valid {
138138
priority = int(routerPriority.Int64)
139139
}
@@ -268,9 +268,9 @@ func (h *ResourceHandler) AssignMiddleware(c *gin.Context) {
268268
return
269269
}
270270

271-
// Default priority is 100 if not specified
271+
// Default priority is 200 if not specified
272272
if input.Priority <= 0 {
273-
input.Priority = 100
273+
input.Priority = 200
274274
}
275275

276276
// Verify resource exists
@@ -428,9 +428,9 @@ func (h *ResourceHandler) AssignMultipleMiddlewares(c *gin.Context) {
428428
log.Printf("Assigning %d middlewares to resource %s", len(input.Middlewares), resourceID)
429429

430430
for _, mw := range input.Middlewares {
431-
// Default priority is 100 if not specified
431+
// Default priority is 200 if not specified
432432
if mw.Priority <= 0 {
433-
mw.Priority = 100
433+
mw.Priority = 200
434434
}
435435

436436
// Verify middleware exists

0 commit comments

Comments
 (0)