Skip to content

Commit b75e715

Browse files
committed
Merge branch 'main' into pushpinderbal/main
2 parents 5a046bc + 03ed183 commit b75e715

46 files changed

Lines changed: 1074 additions & 1259 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 86 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,86 @@
1-
PORT=3000
2-
ADDRESS=0.0.0.0
3-
APP_URL=http://localhost:3000
4-
USERS=your_user_password_hash
5-
USERS_FILE=users_file
6-
SECURE_COOKIE=false
7-
OAUTH_WHITELIST=
8-
GENERIC_NAME=My OAuth
9-
SESSION_EXPIRY=7200
10-
LOGIN_TIMEOUT=300
11-
LOGIN_MAX_RETRIES=5
12-
LOG_LEVEL=debug
13-
APP_TITLE=Tinyauth SSO
14-
FORGOT_PASSWORD_MESSAGE=Some message about resetting the password
15-
OAUTH_AUTO_REDIRECT=none
16-
BACKGROUND_IMAGE=some_image_url
17-
GENERIC_SKIP_SSL=false
18-
RESOURCES_DIR=/data/resources
19-
DATABASE_PATH=/data/tinyauth.db
20-
DISABLE_ANALYTICS=false
21-
DISABLE_RESOURCES=false
22-
TRUSTED_PROXIES=
1+
# Base Configuration
2+
3+
# The base URL where Tinyauth is accessible
4+
TINYAUTH_APPURL="https://auth.example.com"
5+
# Log level: trace, debug, info, warn, error
6+
TINYAUTH_LOGLEVEL="info"
7+
# Directory for static resources
8+
TINYAUTH_RESOURCESDIR="/data/resources"
9+
# Path to SQLite database file
10+
TINYAUTH_DATABASEPATH="/data/tinyauth.db"
11+
# Disable version heartbeat
12+
TINYAUTH_DISABLEANALYTICS="false"
13+
# Disable static resource serving
14+
TINYAUTH_DISABLERESOURCES="false"
15+
# Disable UI warning messages
16+
TINYAUTH_DISABLEUIWARNINGS="false"
17+
# Enable JSON formatted logs
18+
TINYAUTH_LOGJSON="false"
19+
20+
# Server Configuration
21+
22+
# Port to listen on
23+
TINYAUTH_SERVER_PORT="3000"
24+
# Interface to bind to (0.0.0.0 for all interfaces)
25+
TINYAUTH_SERVER_ADDRESS="0.0.0.0"
26+
# Unix socket path (optional, overrides port/address if set)
27+
TINYAUTH_SERVER_SOCKETPATH=""
28+
# Comma-separated list of trusted proxy IPs/CIDRs
29+
TINYAUTH_SERVER_TRUSTEDPROXIES=""
30+
31+
# Authentication Configuration
32+
33+
# Format: username:bcrypt_hash (use bcrypt to generate hash)
34+
TINYAUTH_AUTH_USERS="admin:$2a$10$example_bcrypt_hash_here"
35+
# Path to external users file (optional)
36+
TINYAUTH_USERSFILE=""
37+
# Enable secure cookies (requires HTTPS)
38+
TINYAUTH_SECURECOOKIE="true"
39+
# Session expiry in seconds (7200 = 2 hours)
40+
TINYAUTH_SESSIONEXPIRY="7200"
41+
# Login timeout in seconds (300 = 5 minutes)
42+
TINYAUTH_LOGINTIMEOUT="300"
43+
# Maximum login retries before lockout
44+
TINYAUTH_LOGINMAXRETRIES="5"
45+
46+
# OAuth Configuration
47+
48+
# Regex pattern for allowed email addresses (e.g., /@example\.com$/)
49+
TINYAUTH_OAUTH_WHITELIST=""
50+
# Provider ID to auto-redirect to (skips login page)
51+
TINYAUTH_OAUTH_AUTOREDIRECT=""
52+
# OAuth Provider Configuration (replace MYPROVIDER with your provider name)
53+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_CLIENTID="your_client_id_here"
54+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_CLIENTSECRET="your_client_secret_here"
55+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_AUTHURL="https://provider.example.com/oauth/authorize"
56+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_TOKENURL="https://provider.example.com/oauth/token"
57+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_USERINFOURL="https://provider.example.com/oauth/userinfo"
58+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_REDIRECTURL="https://auth.example.com/oauth/callback/myprovider"
59+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_SCOPES="openid email profile"
60+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_NAME="My OAuth Provider"
61+
# Allow self-signed certificates
62+
TINYAUTH_OAUTH_PROVIDERS_MYPROVIDER_INSECURE="false"
63+
64+
# UI Customization
65+
66+
# Custom title for login page
67+
TINYAUTH_UI_TITLE="Tinyauth"
68+
# Message shown on forgot password page
69+
TINYAUTH_UI_FORGOTPASSWORDMESSAGE="Contact your administrator to reset your password"
70+
# Background image URL for login page
71+
TINYAUTH_UI_BACKGROUNDIMAGE=""
72+
73+
# LDAP Configuration
74+
75+
# LDAP server address
76+
TINYAUTH_LDAP_ADDRESS="ldap://ldap.example.com:389"
77+
# DN for binding to LDAP server
78+
TINYAUTH_LDAP_BINDDN="cn=readonly,dc=example,dc=com"
79+
# Password for bind DN
80+
TINYAUTH_LDAP_BINDPASSWORD="your_bind_password"
81+
# Base DN for user searches
82+
TINYAUTH_LDAP_BASEDN="dc=example,dc=com"
83+
# Search filter (%s will be replaced with username)
84+
TINYAUTH_LDAP_SEARCHFILTER="(&(uid=%s)(memberOf=cn=users,ou=groups,dc=example,dc=com))"
85+
# Allow insecure LDAP connections
86+
TINYAUTH_LDAP_INSECURE="false"

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
- name: Build
8181
run: |
8282
cp -r frontend/dist internal/assets/dist
83-
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64
83+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64 ./cmd/tinyauth
8484
env:
8585
CGO_ENABLED: 0
8686

@@ -126,7 +126,7 @@ jobs:
126126
- name: Build
127127
run: |
128128
cp -r frontend/dist internal/assets/dist
129-
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64
129+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64 ./cmd/tinyauth
130130
env:
131131
CGO_ENABLED: 0
132132

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: Build
5959
run: |
6060
cp -r frontend/dist internal/assets/dist
61-
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64
61+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64 ./cmd/tinyauth
6262
env:
6363
CGO_ENABLED: 0
6464

@@ -101,7 +101,7 @@ jobs:
101101
- name: Build
102102
run: |
103103
cp -r frontend/dist internal/assets/dist
104-
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64
104+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64 ./cmd/tinyauth
105105
env:
106106
CGO_ENABLED: 0
107107

.gitignore

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
# dist
2-
internal/assets/dist
2+
/internal/assets/dist
33

44
# binaries
5-
tinyauth
5+
/tinyauth
66

77
# test docker compose
8-
docker-compose.test*
8+
/docker-compose.test*
99

1010
# users file
11-
users.txt
11+
/users.txt
1212

1313
# secret test file
14-
secret*
14+
/secret*
1515

1616
# apple stuff
1717
.DS_Store
1818

1919
# env
20-
.env
20+
/.env
2121

2222
# tmp directory
23-
tmp
23+
/tmp
2424

2525
# version files
26-
internal/assets/version
26+
/internal/assets/version
2727

2828
# data directory
29-
data
29+
/data
30+
31+
# config file
32+
/config.yml
33+
34+
# binary out
35+
/tinyauth.db
36+
/resources

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ COPY go.sum ./
3333

3434
RUN go mod download
3535

36-
COPY ./main.go ./
3736
COPY ./cmd ./cmd
3837
COPY ./internal ./internal
3938
COPY --from=frontend-builder /frontend/dist ./internal/assets/dist
4039

41-
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}"
40+
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth
4241

4342
# Runner
4443
FROM alpine:3.23 AS runner
@@ -53,6 +52,10 @@ EXPOSE 3000
5352

5453
VOLUME ["/data"]
5554

55+
ENV DATABASEPATH=/data/tinyauth.db
56+
57+
ENV RESOURCESDIR=/data/resources
58+
5659
ENV GIN_MODE=release
5760

5861
ENV PATH=$PATH:/tinyauth

Dockerfile.dev

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ RUN go install github.com/go-delve/delve/cmd/dlv@latest
1212

1313
COPY ./cmd ./cmd
1414
COPY ./internal ./internal
15-
COPY ./main.go ./
1615
COPY ./air.toml ./
1716

1817
EXPOSE 3000
1918

19+
ENV TINYAUTH_DATABASEPATH=/data/tinyauth.db
20+
21+
ENV TINYAUTH_RESOURCESDIR=/data/resources
22+
2023
ENTRYPOINT ["air", "-c", "air.toml"]

Dockerfile.distroless

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ COPY go.sum ./
3333

3434
RUN go mod download
3535

36-
COPY ./main.go ./
3736
COPY ./cmd ./cmd
3837
COPY ./internal ./internal
3938
COPY --from=frontend-builder /frontend/dist ./internal/assets/dist
4039

4140
RUN mkdir -p data
4241

43-
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}"
42+
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth
4443

4544
# Runner
4645
FROM gcr.io/distroless/static-debian12:latest AS runner
@@ -56,6 +55,10 @@ EXPOSE 3000
5655

5756
VOLUME ["/data"]
5857

58+
ENV TINYAUTH_DATABASEPATH=/data/tinyauth.db
59+
60+
ENV TINYAUTH_RESOURCESDIR=/data/resources
61+
5962
ENV GIN_MODE=release
6063

6164
ENV PATH=$PATH:/tinyauth

air.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tmp_dir = "tmp"
33

44
[build]
55
pre_cmd = ["mkdir -p internal/assets/dist", "mkdir -p /data", "echo 'backend running' > internal/assets/dist/index.html"]
6-
cmd = "CGO_ENABLED=0 go build -gcflags=\"all=-N -l\" -o tmp/tinyauth ."
6+
cmd = "CGO_ENABLED=0 go build -gcflags=\"all=-N -l\" -o tmp/tinyauth ./cmd/tinyauth"
77
bin = "tmp/tinyauth"
88
full_bin = "dlv --listen :4000 --headless=true --api-version=2 --accept-multiclient --log=true exec tmp/tinyauth --continue --check-go-version=false"
99
include_ext = ["go"]

cmd/create.go

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)