mirror of
https://github.com/tinyauthapp/tinyauth.git
synced 2026-09-04 21:23:34 +08:00
Compare commits
7
Commits
v5.2.0-beta.1
...
nightly
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b61fc6b54e | ||
|
|
bbcc8cafa6 | ||
|
|
b63a6917fe | ||
|
|
59116f7344 | ||
|
|
97eb1efb0e | ||
|
|
1112d84667 | ||
|
|
b01f49cc44 |
+1
-1
@@ -204,7 +204,7 @@ TINYAUTH_UI_TITLE="Tinyauth"
|
|||||||
# Message displayed on the forgot password page.
|
# Message displayed on the forgot password page.
|
||||||
TINYAUTH_UI_FORGOTPASSWORDMESSAGE="You can change your password by changing the configuration."
|
TINYAUTH_UI_FORGOTPASSWORDMESSAGE="You can change your password by changing the configuration."
|
||||||
# Path to the background image.
|
# Path to the background image.
|
||||||
TINYAUTH_UI_BACKGROUNDIMAGE="/background.jpg"
|
TINYAUTH_UI_BACKGROUNDIMAGE="/background.webp"
|
||||||
# Enable UI warnings.
|
# Enable UI warnings.
|
||||||
TINYAUTH_UI_WARNINGSENABLED=true
|
TINYAUTH_UI_WARNINGSENABLED=true
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
REPO: ${{ github.event.repository.name }}
|
REPO: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
|
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
||||||
with:
|
with:
|
||||||
prerelease: true
|
prerelease: true
|
||||||
tag_name: nightly
|
tag_name: nightly
|
||||||
@@ -476,7 +476,7 @@ jobs:
|
|||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
|
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
||||||
with:
|
with:
|
||||||
files: binaries/*
|
files: binaries/*
|
||||||
tag_name: nightly
|
tag_name: nightly
|
||||||
|
|||||||
@@ -449,6 +449,6 @@ jobs:
|
|||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
|
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
|
||||||
with:
|
with:
|
||||||
files: binaries/*
|
files: binaries/*
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# Site builder
|
# Site builder
|
||||||
FROM node:26.7-alpine3.23 AS frontend-builder
|
FROM node:26.8-alpine3.23 AS frontend-builder
|
||||||
|
|
||||||
WORKDIR /frontend
|
WORKDIR /frontend
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Site builder
|
# Site builder
|
||||||
FROM node:26.7-alpine3.23 AS frontend-builder
|
FROM node:26.8-alpine3.23 AS frontend-builder
|
||||||
|
|
||||||
WORKDIR /frontend
|
WORKDIR /frontend
|
||||||
|
|
||||||
|
|||||||
@@ -87,4 +87,4 @@ A huge thank you to [selfh.st](https://selfh.st) for their generous donation to
|
|||||||
|
|
||||||
- **Freepik** for providing the police hat and badge.
|
- **Freepik** for providing the police hat and badge.
|
||||||
- **Renee French** for the original gopher logo.
|
- **Renee French** for the original gopher logo.
|
||||||
- **Syrhu** for providing the background image of the app.
|
- [Siru Zhou](https://unsplash.com/@syrhu) for providing the background image of the app.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
@@ -4,9 +4,13 @@ export default defineConfig({
|
|||||||
testDir: './specs',
|
testDir: './specs',
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
forbidOnly: false,
|
forbidOnly: false,
|
||||||
retries: 0,
|
retries: 3,
|
||||||
workers: 4,
|
workers: 4,
|
||||||
reporter: 'html',
|
reporter: 'html',
|
||||||
|
timeout: 60_000,
|
||||||
|
expect: {
|
||||||
|
timeout: 10_000,
|
||||||
|
},
|
||||||
use: {
|
use: {
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
video: 'on',
|
video: 'on',
|
||||||
|
|||||||
@@ -26,19 +26,19 @@
|
|||||||
"i18next": "^26.4.0",
|
"i18next": "^26.4.0",
|
||||||
"i18next-browser-languagedetector": "^8.2.1",
|
"i18next-browser-languagedetector": "^8.2.1",
|
||||||
"i18next-resources-to-backend": "^1.2.3",
|
"i18next-resources-to-backend": "^1.2.3",
|
||||||
"lucide-react": "^1.35.0",
|
"lucide-react": "^1.38.0",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"radix-ui": "^1.6.7",
|
"radix-ui": "^1.6.7",
|
||||||
"react": "^19.2.8",
|
"react": "^19.2.8",
|
||||||
"react-dom": "^19.2.8",
|
"react-dom": "^19.2.8",
|
||||||
"react-hook-form": "^7.86.0",
|
"react-hook-form": "^7.87.0",
|
||||||
"react-i18next": "^17.0.12",
|
"react-i18next": "^17.0.12",
|
||||||
"react-markdown": "^10.1.0",
|
"react-markdown": "^10.1.0",
|
||||||
"react-router": "^8.3.0",
|
"react-router": "^8.3.1",
|
||||||
"sonner": "^2.0.8",
|
"sonner": "^2.0.8",
|
||||||
"tailwind-merge": "^3.5.0",
|
"tailwind-merge": "^3.5.0",
|
||||||
"tailwindcss": "^4.3.3",
|
"tailwindcss": "^4.3.3",
|
||||||
"zod": "^4.3.6"
|
"zod": "^4.5.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
|
|||||||
Generated
+28
-28
@@ -10,7 +10,7 @@ importers:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@hookform/resolvers':
|
'@hookform/resolvers':
|
||||||
specifier: ^5.9.1
|
specifier: ^5.9.1
|
||||||
version: 5.9.1(react-hook-form@7.86.0(react@19.2.8))(zod@4.4.3)
|
version: 5.9.1(react-hook-form@7.87.0(react@19.2.8))(zod@4.5.4)
|
||||||
'@radix-ui/react-dropdown-menu':
|
'@radix-ui/react-dropdown-menu':
|
||||||
specifier: ^2.1.24
|
specifier: ^2.1.24
|
||||||
version: 2.1.24(@types/react-dom@19.2.5(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
version: 2.1.24(@types/react-dom@19.2.5(@types/react@19.2.18))(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||||
@@ -51,8 +51,8 @@ importers:
|
|||||||
specifier: ^1.2.3
|
specifier: ^1.2.3
|
||||||
version: 1.2.3
|
version: 1.2.3
|
||||||
lucide-react:
|
lucide-react:
|
||||||
specifier: ^1.35.0
|
specifier: ^1.38.0
|
||||||
version: 1.35.0(react@19.2.8)
|
version: 1.38.0(react@19.2.8)
|
||||||
next-themes:
|
next-themes:
|
||||||
specifier: ^0.4.6
|
specifier: ^0.4.6
|
||||||
version: 0.4.6(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
version: 0.4.6(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||||
@@ -66,8 +66,8 @@ importers:
|
|||||||
specifier: ^19.2.8
|
specifier: ^19.2.8
|
||||||
version: 19.2.8(react@19.2.8)
|
version: 19.2.8(react@19.2.8)
|
||||||
react-hook-form:
|
react-hook-form:
|
||||||
specifier: ^7.86.0
|
specifier: ^7.87.0
|
||||||
version: 7.86.0(react@19.2.8)
|
version: 7.87.0(react@19.2.8)
|
||||||
react-i18next:
|
react-i18next:
|
||||||
specifier: ^17.0.12
|
specifier: ^17.0.12
|
||||||
version: 17.0.12(i18next@26.4.0(typescript@6.0.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(typescript@6.0.3)
|
version: 17.0.12(i18next@26.4.0(typescript@6.0.3))(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(typescript@6.0.3)
|
||||||
@@ -75,8 +75,8 @@ importers:
|
|||||||
specifier: ^10.1.0
|
specifier: ^10.1.0
|
||||||
version: 10.1.0(@types/react@19.2.18)(react@19.2.8)
|
version: 10.1.0(@types/react@19.2.18)(react@19.2.8)
|
||||||
react-router:
|
react-router:
|
||||||
specifier: ^8.3.0
|
specifier: ^8.3.1
|
||||||
version: 8.3.0(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
version: 8.3.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||||
sonner:
|
sonner:
|
||||||
specifier: ^2.0.8
|
specifier: ^2.0.8
|
||||||
version: 2.0.8(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
version: 2.0.8(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||||
@@ -87,8 +87,8 @@ importers:
|
|||||||
specifier: ^4.3.3
|
specifier: ^4.3.3
|
||||||
version: 4.3.3
|
version: 4.3.3
|
||||||
zod:
|
zod:
|
||||||
specifier: ^4.3.6
|
specifier: ^4.5.4
|
||||||
version: 4.4.3
|
version: 4.5.4
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@eslint/js':
|
'@eslint/js':
|
||||||
specifier: ^10.0.1
|
specifier: ^10.0.1
|
||||||
@@ -2053,8 +2053,8 @@ packages:
|
|||||||
lru-cache@5.1.1:
|
lru-cache@5.1.1:
|
||||||
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
|
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
|
||||||
|
|
||||||
lucide-react@1.35.0:
|
lucide-react@1.38.0:
|
||||||
resolution: {integrity: sha512-yXCCWxGFYT6bLIPYC4SY6fPQPRs/d797rRIue+J9XP2Td6vQvD53gaQRBCnIVT1kTQRHtAtxlfOQNWAuIF8ELg==}
|
resolution: {integrity: sha512-xZCyBd/wiVUDactoCc+42TjL0aB7EBOXsuX+tjz+W/sGzw2KhHpL1NOH3FIaVUcpimvUBpIYfz34Ofj9S5JEzQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
|
||||||
@@ -2263,8 +2263,8 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^19.2.8
|
react: ^19.2.8
|
||||||
|
|
||||||
react-hook-form@7.86.0:
|
react-hook-form@7.87.0:
|
||||||
resolution: {integrity: sha512-4kbWJrh5jPZt1+YqVcXcGKffGcXV/XVbozknLh0Yjh0KhpoAkus21TAQhzRYqNwFkkObmnSvRlZZ3GT+ehoIrA==}
|
resolution: {integrity: sha512-zhFzWvLxNHH+8839OnZcUxgMZw88ah2jZWDWvKWgF3Tpbnd0vKL+dlcuU3nZVWESZQjd81EW8K+wU+cYfYAc0w==}
|
||||||
engines: {node: '>=18.0.0'}
|
engines: {node: '>=18.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: ^16.8.0 || ^17 || ^18 || ^19
|
react: ^16.8.0 || ^17 || ^18 || ^19
|
||||||
@@ -2311,8 +2311,8 @@ packages:
|
|||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
react-router@8.3.0:
|
react-router@8.3.1:
|
||||||
resolution: {integrity: sha512-qyPMvW83jGIct3yiieisxdk9M745anqhpIMKN5m1t6yBMfgVPpt77aHOqs5fUlEJRMCGffg9BaQLH9oPVOL7xQ==}
|
resolution: {integrity: sha512-TEOpiO2g0TJHEOJeRVv4amUFun9v1npCKszvcquNvzETUtJ8udV86ah5eFoHT7g26bsBvT6EiIhqulR8eDF++A==}
|
||||||
engines: {node: '>=22.22.0'}
|
engines: {node: '>=22.22.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: '>=19.2.7'
|
react: '>=19.2.7'
|
||||||
@@ -2619,8 +2619,8 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
zod: ^3.25.0 || ^4.0.0
|
zod: ^3.25.0 || ^4.0.0
|
||||||
|
|
||||||
zod@4.4.3:
|
zod@4.5.4:
|
||||||
resolution: {integrity: sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==}
|
resolution: {integrity: sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==}
|
||||||
|
|
||||||
zwitch@2.0.4:
|
zwitch@2.0.4:
|
||||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||||
@@ -2782,12 +2782,12 @@ snapshots:
|
|||||||
|
|
||||||
'@floating-ui/utils@0.2.12': {}
|
'@floating-ui/utils@0.2.12': {}
|
||||||
|
|
||||||
'@hookform/resolvers@5.9.1(react-hook-form@7.86.0(react@19.2.8))(zod@4.4.3)':
|
'@hookform/resolvers@5.9.1(react-hook-form@7.87.0(react@19.2.8))(zod@4.5.4)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@standard-schema/utils': 0.3.0
|
'@standard-schema/utils': 0.3.0
|
||||||
react-hook-form: 7.86.0(react@19.2.8)
|
react-hook-form: 7.87.0(react@19.2.8)
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
zod: 4.4.3
|
zod: 4.5.4
|
||||||
|
|
||||||
'@humanfs/core@0.19.2':
|
'@humanfs/core@0.19.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -4023,8 +4023,8 @@ snapshots:
|
|||||||
'@babel/parser': 7.29.3
|
'@babel/parser': 7.29.3
|
||||||
eslint: 10.9.1(jiti@2.7.0)
|
eslint: 10.9.1(jiti@2.7.0)
|
||||||
hermes-parser: 0.25.1
|
hermes-parser: 0.25.1
|
||||||
zod: 4.4.3
|
zod: 4.5.4
|
||||||
zod-validation-error: 4.0.2(zod@4.4.3)
|
zod-validation-error: 4.0.2(zod@4.5.4)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
@@ -4414,7 +4414,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist: 3.1.1
|
yallist: 3.1.1
|
||||||
|
|
||||||
lucide-react@1.35.0(react@19.2.8):
|
lucide-react@1.38.0(react@19.2.8):
|
||||||
dependencies:
|
dependencies:
|
||||||
react: 19.2.8
|
react: 19.2.8
|
||||||
|
|
||||||
@@ -4799,7 +4799,7 @@ snapshots:
|
|||||||
react: 19.2.8
|
react: 19.2.8
|
||||||
scheduler: 0.27.0
|
scheduler: 0.27.0
|
||||||
|
|
||||||
react-hook-form@7.86.0(react@19.2.8):
|
react-hook-form@7.87.0(react@19.2.8):
|
||||||
dependencies:
|
dependencies:
|
||||||
react: 19.2.8
|
react: 19.2.8
|
||||||
|
|
||||||
@@ -4851,7 +4851,7 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 19.2.18
|
'@types/react': 19.2.18
|
||||||
|
|
||||||
react-router@8.3.0(react-dom@19.2.8(react@19.2.8))(react@19.2.8):
|
react-router@8.3.1(react-dom@19.2.8(react@19.2.8))(react@19.2.8):
|
||||||
dependencies:
|
dependencies:
|
||||||
cookie-es: 3.1.1
|
cookie-es: 3.1.1
|
||||||
react: 19.2.8
|
react: 19.2.8
|
||||||
@@ -5130,10 +5130,10 @@ snapshots:
|
|||||||
|
|
||||||
yocto-queue@0.1.0: {}
|
yocto-queue@0.1.0: {}
|
||||||
|
|
||||||
zod-validation-error@4.0.2(zod@4.4.3):
|
zod-validation-error@4.0.2(zod@4.5.4):
|
||||||
dependencies:
|
dependencies:
|
||||||
zod: 4.4.3
|
zod: 4.5.4
|
||||||
|
|
||||||
zod@4.4.3: {}
|
zod@4.5.4: {}
|
||||||
|
|
||||||
zwitch@2.0.4: {}
|
zwitch@2.0.4: {}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 530 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 224 KiB |
@@ -53,7 +53,7 @@ func NewDefaultConfiguration(runtimeEnv RuntimeEnv) *Config {
|
|||||||
UI: UIConfig{
|
UI: UIConfig{
|
||||||
Title: "Tinyauth",
|
Title: "Tinyauth",
|
||||||
ForgotPasswordMessage: "You can change your password by changing the configuration.",
|
ForgotPasswordMessage: "You can change your password by changing the configuration.",
|
||||||
BackgroundImage: "/background.jpg",
|
BackgroundImage: "/background.webp",
|
||||||
WarningsEnabled: true,
|
WarningsEnabled: true,
|
||||||
},
|
},
|
||||||
LDAP: LDAPConfig{
|
LDAP: LDAPConfig{
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/cenkalti/backoff/v5"
|
||||||
"github.com/steveiliop56/ding"
|
"github.com/steveiliop56/ding"
|
||||||
"github.com/tinyauthapp/tinyauth/internal/model"
|
"github.com/tinyauthapp/tinyauth/internal/model"
|
||||||
"github.com/tinyauthapp/tinyauth/internal/utils/decoders"
|
"github.com/tinyauthapp/tinyauth/internal/utils/decoders"
|
||||||
@@ -14,6 +18,10 @@ import (
|
|||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrPingFailed = fmt.Errorf("failed to ping docker")
|
||||||
|
)
|
||||||
|
|
||||||
type DockerService struct {
|
type DockerService struct {
|
||||||
log *logger.Logger
|
log *logger.Logger
|
||||||
client *client.Client
|
client *client.Client
|
||||||
@@ -31,26 +39,54 @@ type DockerServiceInput struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewDockerService(i DockerServiceInput) (*DockerService, error) {
|
func NewDockerService(i DockerServiceInput) (*DockerService, error) {
|
||||||
client, err := client.NewClientWithOpts(client.FromEnv)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
client.NegotiateAPIVersion(i.Ctx)
|
|
||||||
|
|
||||||
_, err = client.Ping(i.Ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
i.Log.App.Debug().Err(err).Msg("Docker not connected")
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
service := &DockerService{
|
service := &DockerService{
|
||||||
log: i.Log,
|
log: i.Log,
|
||||||
client: client,
|
|
||||||
context: i.Ctx,
|
context: i.Ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service.log.App.Debug().Msg("Attempting to connect to Docker")
|
||||||
|
|
||||||
|
if os.Getenv("DOCKER_HOST") == "" {
|
||||||
|
cli, err := service.connect()
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, ErrPingFailed) {
|
||||||
|
service.log.App.Debug().Msg("Docker not connected")
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("failed to connect to docker: %w", err)
|
||||||
|
}
|
||||||
|
service.client = cli
|
||||||
|
} else {
|
||||||
|
exp := backoff.NewExponentialBackOff()
|
||||||
|
exp.InitialInterval = 3 * time.Second
|
||||||
|
exp.RandomizationFactor = 0.1
|
||||||
|
exp.Multiplier = 1.5
|
||||||
|
exp.Reset()
|
||||||
|
|
||||||
|
operation := func() (*client.Client, error) {
|
||||||
|
if service.client != nil {
|
||||||
|
service.client.Close()
|
||||||
|
}
|
||||||
|
cli, err := service.connect()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return cli, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
cli, err := backoff.Retry(service.context, operation, backoff.WithBackOff(exp), backoff.WithMaxTries(3))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, ErrPingFailed) {
|
||||||
|
service.log.App.Debug().Msg("Docker not connected after retrying")
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("failed to connect to docker after retrying: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
service.client = cli
|
||||||
|
}
|
||||||
|
|
||||||
service.isConnected = true
|
service.isConnected = true
|
||||||
service.log.App.Debug().Msg("Docker connected successfully")
|
service.log.App.Debug().Msg("Docker connected successfully")
|
||||||
|
|
||||||
@@ -59,6 +95,22 @@ func NewDockerService(i DockerServiceInput) (*DockerService, error) {
|
|||||||
return service, nil
|
return service, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (docker *DockerService) connect() (*client.Client, error) {
|
||||||
|
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = cli.Ping(docker.context)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, ErrPingFailed
|
||||||
|
}
|
||||||
|
|
||||||
|
return cli, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (docker *DockerService) getContainers() ([]container.Summary, error) {
|
func (docker *DockerService) getContainers() ([]container.Summary, error) {
|
||||||
return docker.client.ContainerList(docker.context, container.ListOptions{})
|
return docker.client.ContainerList(docker.context, container.ListOptions{})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func CreateTestConfigs(t *testing.T) (model.Config, model.RuntimeConfig) {
|
|||||||
UI: model.UIConfig{
|
UI: model.UIConfig{
|
||||||
Title: "Tinyauth Test",
|
Title: "Tinyauth Test",
|
||||||
ForgotPasswordMessage: "foo",
|
ForgotPasswordMessage: "foo",
|
||||||
BackgroundImage: "/background.jpg",
|
BackgroundImage: "/background.webp",
|
||||||
WarningsEnabled: true,
|
WarningsEnabled: true,
|
||||||
},
|
},
|
||||||
OAuth: model.OAuthConfig{
|
OAuth: model.OAuthConfig{
|
||||||
|
|||||||
Reference in New Issue
Block a user