This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin-gateway.git
The following commit(s) were added to refs/heads/master by this push:
new 0327d6e refactor: rename caswaf to casbin-gateway
0327d6e is described below
commit 0327d6e6b6a5e0b1977f262a1cb129088ef45f2f
Author: Yang Luo <[email protected]>
AuthorDate: Mon Aug 17 12:36:38 2026 +0800
refactor: rename caswaf to casbin-gateway
---
.gitignore | 2 +-
Dockerfile | 6 +++---
README.md | 8 ++++----
conf/app.conf | 6 +++---
conf/conf.go | 2 +-
docker-compose.yml | 6 +++---
k8s/.env.example | 20 ++++++++++----------
k8s/README.md | 50 +++++++++++++++++++++++++-------------------------
k8s/configmap.yaml | 10 +++++-----
k8s/deploy.sh | 18 +++++++++---------
k8s/deployment.yaml | 24 ++++++++++++------------
k8s/ingress.yaml | 12 ++++++------
k8s/kustomization.yaml | 6 +++---
k8s/namespace.yaml | 2 +-
k8s/pvc.yaml | 6 +++---
k8s/secret.yaml | 4 ++--
object/site_test.go | 4 ++--
service/captcha.go | 2 +-
service/oauth.go | 2 +-
service/proxy.go | 4 ++--
util/port_test.go | 4 ++--
util/supervisor.go | 2 +-
22 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/.gitignore b/.gitignore
index 87e9ff6..4704935 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,7 @@
*.iml
# Built binaries
-caswaf
+casbin-gateway
tmp/
tmpFiles/
diff --git a/Dockerfile b/Dockerfile
index fdfb531..32d7377 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,16 +4,16 @@ COPY ./web .
RUN yarn install --frozen-lockfile --network-timeout 1000000 && yarn run build
FROM golang:1.20.12 AS BACK
-WORKDIR /go/src/caswaf
+WORKDIR /go/src/casbin-gateway
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o server .
FROM alpine:latest AS STANDARD
LABEL MAINTAINER="https://caswaf.org/"
-COPY --from=BACK /go/src/caswaf/ ./
+COPY --from=BACK /go/src/casbin-gateway/ ./
RUN mkdir -p web/build && apk add --no-cache bash coreutils tzdata
COPY --from=FRONT /web/build /web/build
-# Holds the SQLite database at /data/caswaf.db.
+# Holds the SQLite database at /data/casbin-gateway.db.
VOLUME /data
ENTRYPOINT ["./server"]
diff --git a/README.md b/README.md
index 8c7e58f..37f39eb 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ The reverse-proxy gateway on ports 80 and 443 is disabled by
default, so startin
### Quick start
-From nothing to a request flowing through the gateway, in four steps. No
database server is needed: Gateway creates `./data/caswaf.db` on first start.
+From nothing to a request flowing through the gateway, in four steps. No
database server is needed: Gateway creates `./data/casbin-gateway.db` on first
start.
#### 1. Build the web UI
@@ -94,7 +94,7 @@ It prints a summary of what it is actually doing — ports,
whether the reverse
| Reverse proxy | enabled |
| Gateway HTTP | :8080 |
| Gateway HTTPS | :8443 |
-| Database | sqlite, file "./data/caswaf.db" (connected) |
+| Database | sqlite, file "./data/casbin-gateway.db" (connected) |
| Sign-in | built-in user table, Casdoor is not configured |
| App dir | ./data/apps |
+----------------+-----------------------------------------------------------+
@@ -153,14 +153,14 @@ driverName = sqlite
dataSourceName =
```
-An empty `dataSourceName` means `./data/caswaf.db`, relative to the working
directory. Set it to another path to move the file.
+An empty `dataSourceName` means `./data/casbin-gateway.db`, relative to the
working directory. Set it to another path to move the file.
Casbin Gateway uses XORM to connect to DB, so all DBs supported by XORM can
also be used. To use MySQL instead, point it at your server and Gateway creates
the database named by `dbName` if it does not exist:
```ini
driverName = mysql
dataSourceName = root:123@tcp(localhost:3306)/
-dbName = caswaf
+dbName = casbin_gateway
```
#### Run Casbin Gateway
diff --git a/conf/app.conf b/conf/app.conf
index 05a080d..6c218ac 100644
--- a/conf/app.conf
+++ b/conf/app.conf
@@ -1,11 +1,11 @@
-appname = caswaf
+appname = casbin-gateway
; Port of the management UI and the REST API.
httpport = 17000
runmode = dev
SessionOn = true
copyrequestbody = true
-; Database. An empty "dataSourceName" means "./data/caswaf.db"; "dbName" is
+; Database. An empty "dataSourceName" means "./data/casbin-gateway.db";
"dbName" is
; unused by SQLite. XORM is used, so mysql, postgres, mssql and sqlite are all
; supported. To use MySQL instead, replace the two lines below with:
; driverName = mysql
@@ -13,7 +13,7 @@ copyrequestbody = true
; Gateway then creates "dbName" on first start if it does not exist.
driverName = sqlite
dataSourceName =
-dbName = caswaf
+dbName = casbin_gateway
; Optional Redis for sessions. Sessions are kept in ./tmp files when empty.
redisEndpoint =
diff --git a/conf/conf.go b/conf/conf.go
index 1de5baa..9fb710b 100644
--- a/conf/conf.go
+++ b/conf/conf.go
@@ -117,7 +117,7 @@ func GetConfigInt64(key string) (int64, error) {
}
// DefaultSqliteDataSourceName is used when "dataSourceName" is empty.
-const DefaultSqliteDataSourceName = "./data/caswaf.db"
+const DefaultSqliteDataSourceName = "./data/casbin-gateway.db"
func GetConfigDriverName() string {
driverName := strings.Trim(GetConfigString("driverName"), `"' `)
diff --git a/docker-compose.yml b/docker-compose.yml
index 12ab16f..bf8a875 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,6 @@
version: '3.1'
services:
- caswaf:
+ casbin-gateway:
restart: always
build:
context: ./
@@ -12,7 +12,7 @@ services:
volumes:
- ./conf:/conf/
# Holds the SQLite database, so the data survives "docker compose down".
- - caswaf-data:/data
+ - casbin-gateway-data:/data
volumes:
- caswaf-data:
+ casbin-gateway-data:
diff --git a/k8s/.env.example b/k8s/.env.example
index ac74cf9..9a0b745 100644
--- a/k8s/.env.example
+++ b/k8s/.env.example
@@ -2,8 +2,8 @@
# Copy this file and modify for your environment
# Database Configuration
-CASWAF_DRIVER_NAME=sqlite
-CASWAF_DATA_SOURCE_NAME=/data/caswaf.db
+CASBIN_GATEWAY_DRIVER_NAME=sqlite
+CASBIN_GATEWAY_DATA_SOURCE_NAME=/data/casbin-gateway.db
# Casdoor Configuration
CASDOOR_ENDPOINT=http://casdoor.casdoor-system.svc.cluster.local:8000
@@ -14,17 +14,17 @@ CASDOOR_APPLICATION=app-casdoor-gateway
CASDOOR_INSECURE_SKIP_VERIFY=true
# Casbin Gateway Configuration
-CASWAF_HTTP_PORT=17000
-CASWAF_RUN_MODE=prod
+CASBIN_GATEWAY_HTTP_PORT=17000
+CASBIN_GATEWAY_RUN_MODE=prod
# Ingress Configuration
-CASWAF_DOMAIN=caswaf.example.com
+CASBIN_GATEWAY_DOMAIN=casbin-gateway.example.com
# Storage for the SQLite database
-CASWAF_STORAGE_SIZE=10Gi
+CASBIN_GATEWAY_STORAGE_SIZE=10Gi
# Resources (adjust based on your needs)
-CASWAF_CPU_REQUEST=100m
-CASWAF_CPU_LIMIT=1000m
-CASWAF_MEMORY_REQUEST=256Mi
-CASWAF_MEMORY_LIMIT=1Gi
+CASBIN_GATEWAY_CPU_REQUEST=100m
+CASBIN_GATEWAY_CPU_LIMIT=1000m
+CASBIN_GATEWAY_MEMORY_REQUEST=256Mi
+CASBIN_GATEWAY_MEMORY_LIMIT=1Gi
diff --git a/k8s/README.md b/k8s/README.md
index 4ec5b5e..bb4a4c3 100644
--- a/k8s/README.md
+++ b/k8s/README.md
@@ -13,7 +13,7 @@ This guide provides instructions for deploying Casbin Gateway
on Kubernetes.
The deployment consists of:
- **Casbin Gateway Application**: The main WAF application
-- **PersistentVolumeClaim**: Holds the SQLite database at `/data/caswaf.db`.
There is no database server to deploy
+- **PersistentVolumeClaim**: Holds the SQLite database at
`/data/casbin-gateway.db`. There is no database server to deploy
- **Secrets**: Stores sensitive credentials (Casdoor client ID/secret)
- **ConfigMap**: Contains Casbin Gateway configuration template
- **Service**: Exposes Casbin Gateway within the cluster
@@ -119,13 +119,13 @@ kubectl apply -k k8s/
```bash
# Check if pods are running
-kubectl get pods -n caswaf
+kubectl get pods -n casbin-gateway
# Check logs
-kubectl logs -f deployment/caswaf -n caswaf
+kubectl logs -f deployment/casbin-gateway -n casbin-gateway
# Check services
-kubectl get svc -n caswaf
+kubectl get svc -n casbin-gateway
```
### 7. Access Casbin Gateway
@@ -133,12 +133,12 @@ kubectl get svc -n caswaf
If using Ingress:
```bash
# Update your DNS or /etc/hosts to point to your ingress controller IP
-# Then access: http://caswaf.example.com
+# Then access: http://casbin-gateway.example.com
```
If using port-forward for testing:
```bash
-kubectl port-forward svc/caswaf 17000:17000 -n caswaf
+kubectl port-forward svc/casbin-gateway 17000:17000 -n casbin-gateway
# Access: http://localhost:17000
```
@@ -161,8 +161,8 @@ Key configuration parameters:
| `httpport` | Casbin Gateway HTTP port | `17000` |
| `runmode` | Run mode (dev/prod) | `prod` |
| `driverName` | Database driver | `sqlite` |
-| `dataSourceName` | SQLite file, or the connection string of a database
server | `/data/caswaf.db` |
-| `dbName` | Database name (unused by SQLite) | `caswaf` |
+| `dataSourceName` | SQLite file, or the connection string of a database
server | `/data/casbin-gateway.db` |
+| `dbName` | Database name (unused by SQLite) | `casbin_gateway` |
| `casdoorEndpoint` | Casdoor API endpoint | Required |
| `casdoorInsecureSkipVerify` | Skip TLS verification for Casdoor | `true` |
| `clientId` | Casdoor application client ID | Uses secrets substitution |
@@ -173,7 +173,7 @@ Key configuration parameters:
### Data Volume (`pvc.yaml`)
- 10Gi `ReadWriteOnce` claim mounted at `/data`
-- Holds `caswaf.db`, the SQLite database, plus its `-wal` and `-shm` sidecar
files
+- Holds `casbin-gateway.db`, the SQLite database, plus its `-wal` and `-shm`
sidecar files
- Deleting the claim deletes all Gateway data
### Casbin Gateway Deployment (`deployment.yaml`)
@@ -192,13 +192,13 @@ Features:
#### 1. Pod stuck in `Pending`
-**Cause**: The `caswaf-data-pvc` claim is unbound, usually because the cluster
has no default storage class.
+**Cause**: The `casbin-gateway-data-pvc` claim is unbound, usually because the
cluster has no default storage class.
**Solution**:
```bash
# Check the claim and why it is not bound
-kubectl get pvc -n caswaf
-kubectl describe pvc caswaf-data-pvc -n caswaf
+kubectl get pvc -n casbin-gateway
+kubectl describe pvc casbin-gateway-data-pvc -n casbin-gateway
# List the available storage classes, then set storageClassName in k8s/pvc.yaml
kubectl get storageclass
@@ -211,7 +211,7 @@ kubectl get storageclass
**Solution**:
1. Verify Casdoor is accessible:
```bash
- kubectl run -it --rm debug --image=curlimages/curl --restart=Never -n
caswaf -- \
+ kubectl run -it --rm debug --image=curlimages/curl --restart=Never -n
casbin-gateway -- \
curl -v http://casdoor.casdoor-system.svc.cluster.local:8000
```
@@ -232,10 +232,10 @@ and says whether it answered.
**Solution**:
```bash
# Confirm the SQLite file is on the volume
-kubectl exec -it deployment/caswaf -n caswaf -- ls -l /data
+kubectl exec -it deployment/casbin-gateway -n casbin-gateway -- ls -l /data
# For an external database server, test that it is reachable from the pod
-kubectl exec -it deployment/caswaf -n caswaf -- sh
+kubectl exec -it deployment/casbin-gateway -n casbin-gateway -- sh
# Then inside the pod, e.g.:
# nc -zv mysql.example.com 3306
```
@@ -245,20 +245,20 @@ kubectl exec -it deployment/caswaf -n caswaf -- sh
If the `setup-config` init container never finishes:
```bash
# Check init container logs
-kubectl logs -n caswaf <pod-name> -c setup-config
+kubectl logs -n casbin-gateway <pod-name> -c setup-config
# Force restart
-kubectl rollout restart deployment/caswaf -n caswaf
+kubectl rollout restart deployment/casbin-gateway -n casbin-gateway
```
### Viewing Logs
```bash
# Casbin Gateway logs
-kubectl logs -f deployment/caswaf -n caswaf
+kubectl logs -f deployment/casbin-gateway -n casbin-gateway
# All logs in namespace
-kubectl logs -f -n caswaf --all-containers=true
+kubectl logs -f -n casbin-gateway --all-containers=true
```
## Production Recommendations
@@ -291,9 +291,9 @@ kubectl logs -f -n caswaf --all-containers=true
- Application logs
- Resource usage
-6. **Backup**: Regular backups of the database. For SQLite that is the
`caswaf-data-pvc` volume:
+6. **Backup**: Regular backups of the database. For SQLite that is the
`casbin-gateway-data-pvc` volume:
```bash
- kubectl exec deployment/caswaf -n caswaf -- tar cf - /data > caswaf-data.tar
+ kubectl exec deployment/casbin-gateway -n casbin-gateway -- tar cf - /data
> casbin-gateway-data.tar
```
7. **Security**:
@@ -306,13 +306,13 @@ kubectl logs -f -n caswaf --all-containers=true
```bash
# Update the image version in deployment.yaml, then:
-kubectl set image deployment/caswaf caswaf=casbin/caswaf:NEW_VERSION -n caswaf
+kubectl set image deployment/casbin-gateway
casbin-gateway=casbin/caswaf:NEW_VERSION -n casbin-gateway
# Or apply updated deployment
kubectl apply -f k8s/deployment.yaml
# Check rollout status
-kubectl rollout status deployment/caswaf -n caswaf
+kubectl rollout status deployment/casbin-gateway -n casbin-gateway
```
## Uninstall
@@ -328,7 +328,7 @@ kubectl delete -f k8s/secret.yaml
kubectl delete -f k8s/pvc.yaml
# Or delete the entire namespace
-kubectl delete namespace caswaf
+kubectl delete namespace casbin-gateway
```
## Advanced Configuration
@@ -339,7 +339,7 @@ Edit `configmap.yaml`:
```yaml
driverName = mysql
dataSourceName = root:password@tcp(external-mysql.example.com:3306)/
-dbName = caswaf
+dbName = casbin_gateway
```
Gateway creates `dbName` on first start if it does not exist. Once the data no
diff --git a/k8s/configmap.yaml b/k8s/configmap.yaml
index 854b7c0..5f6facc 100644
--- a/k8s/configmap.yaml
+++ b/k8s/configmap.yaml
@@ -2,11 +2,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: caswaf-config
- namespace: caswaf
+ name: casbin-gateway-config
+ namespace: casbin-gateway
data:
app.conf: |
- appname = caswaf
+ appname = casbin-gateway
httpport = 17000
runmode = prod
SessionOn = true
@@ -14,8 +14,8 @@ data:
# A SQLite file on the PersistentVolumeClaim. For MySQL, set
# driverName = mysql and dataSourceName = root:PASSWORD@tcp(host:3306)/
driverName = sqlite
- dataSourceName = /data/caswaf.db
- dbName = caswaf
+ dataSourceName = /data/casbin-gateway.db
+ dbName = casbin_gateway
redisEndpoint =
gatewayEnabled = false
gatewayHttpPort = 80
diff --git a/k8s/deploy.sh b/k8s/deploy.sh
index 41a6c53..269dbb4 100755
--- a/k8s/deploy.sh
+++ b/k8s/deploy.sh
@@ -77,9 +77,9 @@ echo -e "${YELLOW}Step 4: Deploying Casbin Gateway
application...${NC}"
kubectl apply -f deployment.yaml
echo "Waiting for Casbin Gateway to be ready..."
-kubectl wait --for=condition=ready pod -l app=caswaf -n caswaf --timeout=300s
|| {
+kubectl wait --for=condition=ready pod -l app=casbin-gateway -n casbin-gateway
--timeout=300s || {
echo -e "${RED}Warning: Casbin Gateway took longer than expected to
start${NC}"
- echo "Check logs with: kubectl logs -n caswaf -l app=caswaf"
+ echo "Check logs with: kubectl logs -n casbin-gateway -l
app=casbin-gateway"
}
echo -e "${GREEN}✓ Casbin Gateway is deployed${NC}"
echo
@@ -111,21 +111,21 @@ else
echo -e "${YELLOW}Skipping Ingress deployment${NC}"
echo
echo "You can access Casbin Gateway using port-forward:"
- echo " kubectl port-forward svc/caswaf 17000:17000 -n caswaf"
+ echo " kubectl port-forward svc/casbin-gateway 17000:17000 -n
casbin-gateway"
echo " Then access: http://localhost:17000"
fi
echo
echo -e "${GREEN}Deployment Summary:${NC}"
echo "==================="
-kubectl get all -n caswaf
+kubectl get all -n casbin-gateway
echo
echo -e "${GREEN}✓ Casbin Gateway deployment completed successfully!${NC}"
echo
echo "Useful commands:"
-echo " View pods: kubectl get pods -n caswaf"
-echo " View services: kubectl get svc -n caswaf"
-echo " View logs: kubectl logs -f deployment/caswaf -n caswaf"
-echo " Port forward: kubectl port-forward svc/caswaf 17000:17000 -n
caswaf"
-echo " Delete all: kubectl delete namespace caswaf"
+echo " View pods: kubectl get pods -n casbin-gateway"
+echo " View services: kubectl get svc -n casbin-gateway"
+echo " View logs: kubectl logs -f deployment/casbin-gateway -n
casbin-gateway"
+echo " Port forward: kubectl port-forward svc/casbin-gateway 17000:17000
-n casbin-gateway"
+echo " Delete all: kubectl delete namespace casbin-gateway"
diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml
index 357a15b..6338750 100644
--- a/k8s/deployment.yaml
+++ b/k8s/deployment.yaml
@@ -2,8 +2,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: caswaf
- namespace: caswaf
+ name: casbin-gateway
+ namespace: casbin-gateway
spec:
replicas: 1
# The old pod has to release the SQLite file before the new one starts.
@@ -11,11 +11,11 @@ spec:
type: Recreate
selector:
matchLabels:
- app: caswaf
+ app: casbin-gateway
template:
metadata:
labels:
- app: caswaf
+ app: casbin-gateway
spec:
initContainers:
- name: setup-config
@@ -48,12 +48,12 @@ spec:
- name: CASDOOR_CLIENT_ID
valueFrom:
secretKeyRef:
- name: caswaf-secrets
+ name: casbin-gateway-secrets
key: casdoor-client-id
- name: CASDOOR_CLIENT_SECRET
valueFrom:
secretKeyRef:
- name: caswaf-secrets
+ name: casbin-gateway-secrets
key: casdoor-client-secret
volumeMounts:
- name: config-template
@@ -61,7 +61,7 @@ spec:
- name: config
mountPath: /conf-out
containers:
- - name: caswaf
+ - name: casbin-gateway
image: casbin/caswaf:latest
ports:
- containerPort: 17000
@@ -99,21 +99,21 @@ spec:
volumes:
- name: config-template
configMap:
- name: caswaf-config
+ name: casbin-gateway-config
- name: config
emptyDir: {}
- name: data
persistentVolumeClaim:
- claimName: caswaf-data-pvc
+ claimName: casbin-gateway-data-pvc
---
apiVersion: v1
kind: Service
metadata:
- name: caswaf
- namespace: caswaf
+ name: casbin-gateway
+ namespace: casbin-gateway
spec:
selector:
- app: caswaf
+ app: casbin-gateway
ports:
- port: 17000
targetPort: 17000
diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml
index 14c6f53..b2d2b38 100644
--- a/k8s/ingress.yaml
+++ b/k8s/ingress.yaml
@@ -2,8 +2,8 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: caswaf-ingress
- namespace: caswaf
+ name: casbin-gateway-ingress
+ namespace: casbin-gateway
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
# Add SSL redirect if needed
@@ -11,18 +11,18 @@ metadata:
spec:
ingressClassName: nginx
rules:
- - host: caswaf.example.com # Change this to your domain
+ - host: casbin-gateway.example.com # Change this to your domain
http:
paths:
- path: /
pathType: Prefix
backend:
service:
- name: caswaf
+ name: casbin-gateway
port:
number: 17000
# Uncomment and configure TLS if you have certificates
# tls:
# - hosts:
- # - caswaf.example.com
- # secretName: caswaf-tls
+ # - casbin-gateway.example.com
+ # secretName: casbin-gateway-tls
diff --git a/k8s/kustomization.yaml b/k8s/kustomization.yaml
index 92a9e19..8f6a6ec 100644
--- a/k8s/kustomization.yaml
+++ b/k8s/kustomization.yaml
@@ -2,7 +2,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
-namespace: caswaf
+namespace: casbin-gateway
resources:
- namespace.yaml
@@ -14,8 +14,8 @@ resources:
# You can customize common labels here
commonLabels:
- app.kubernetes.io/name: caswaf
- app.kubernetes.io/part-of: caswaf
+ app.kubernetes.io/name: casbin-gateway
+ app.kubernetes.io/part-of: casbin-gateway
# You can add configuration transformers here
# For example, to change the namespace:
diff --git a/k8s/namespace.yaml b/k8s/namespace.yaml
index df1f468..5d0986f 100644
--- a/k8s/namespace.yaml
+++ b/k8s/namespace.yaml
@@ -2,4 +2,4 @@
apiVersion: v1
kind: Namespace
metadata:
- name: caswaf
+ name: casbin-gateway
diff --git a/k8s/pvc.yaml b/k8s/pvc.yaml
index bcd0d6c..1341f61 100644
--- a/k8s/pvc.yaml
+++ b/k8s/pvc.yaml
@@ -1,10 +1,10 @@
---
-# Holds the SQLite database at /data/caswaf.db.
+# Holds the SQLite database at /data/casbin-gateway.db.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
- name: caswaf-data-pvc
- namespace: caswaf
+ name: casbin-gateway-data-pvc
+ namespace: casbin-gateway
spec:
accessModes:
- ReadWriteOnce
diff --git a/k8s/secret.yaml b/k8s/secret.yaml
index b6f8655..8f6326c 100644
--- a/k8s/secret.yaml
+++ b/k8s/secret.yaml
@@ -2,8 +2,8 @@
apiVersion: v1
kind: Secret
metadata:
- name: caswaf-secrets
- namespace: caswaf
+ name: casbin-gateway-secrets
+ namespace: casbin-gateway
type: Opaque
stringData:
# Casdoor credentials - REQUIRED: Replace these with your actual values
before deployment
diff --git a/object/site_test.go b/object/site_test.go
index af4ecd1..78fb2c9 100644
--- a/object/site_test.go
+++ b/object/site_test.go
@@ -27,7 +27,7 @@ func TestCheckNode(t *testing.T) {
InitConfig()
casdoor.InitCasdoorConfig()
- site, err := getSite("admin", "caswaf_my")
+ site, err := getSite("admin", "casbin-gateway_my")
if err != nil {
panic(err)
}
@@ -41,7 +41,7 @@ func TestCheckNode(t *testing.T) {
panic(err)
}
- site, err = getSite("admin", "caswaf_my")
+ site, err = getSite("admin", "casbin-gateway_my")
if err != nil {
panic(err)
}
diff --git a/service/captcha.go b/service/captcha.go
index bdaa831..59d54ab 100644
--- a/service/captcha.go
+++ b/service/captcha.go
@@ -48,7 +48,7 @@ func redirectToCaptcha(w http.ResponseWriter, r
*http.Request) {
}
scheme := getScheme(r)
- callbackUrl := fmt.Sprintf("%s://%s/caswaf-captcha-verify", scheme,
r.Host)
+ callbackUrl := fmt.Sprintf("%s://%s/_captcha-verify", scheme, r.Host)
captchaUri := fmt.Sprintf(
"%s/captcha?client_id=%s&redirect_uri=%s&state=%s",
getCasdoorEndpoint(),
diff --git a/service/oauth.go b/service/oauth.go
index e4a6e03..33b1c04 100644
--- a/service/oauth.go
+++ b/service/oauth.go
@@ -31,7 +31,7 @@ func getSigninUrl(casdoorClient *auth.Client, callbackUrl
string, originalPath s
func redirectToCasdoor(casdoorClient *auth.Client, w http.ResponseWriter, r
*http.Request) {
scheme := getScheme(r)
- callbackUrl := fmt.Sprintf("%s://%s/caswaf-handler", scheme, r.Host)
+ callbackUrl := fmt.Sprintf("%s://%s/_sso-callback", scheme, r.Host)
originalPath := r.RequestURI
signinUrl := getSigninUrl(casdoorClient, callbackUrl, originalPath)
http.Redirect(w, r, signinUrl, http.StatusFound)
diff --git a/service/proxy.go b/service/proxy.go
index 0bb3b51..5f9bb21 100644
--- a/service/proxy.go
+++ b/service/proxy.go
@@ -324,8 +324,8 @@ func nextHandle(w http.ResponseWriter, r *http.Request) {
func Start() {
serverMux := http.NewServeMux()
serverMux.HandleFunc("/", handleRequest)
- serverMux.HandleFunc("/caswaf-handler", handleAuthCallback)
- serverMux.HandleFunc("/caswaf-captcha-verify", handleCaptchaCallback)
+ serverMux.HandleFunc("/_sso-callback", handleAuthCallback)
+ serverMux.HandleFunc("/_captcha-verify", handleCaptchaCallback)
if !conf.IsGatewayEnabled() {
fmt.Printf("Casbin Gateway reverse proxy is not enabled
(gatewayEnabled = false), so site configurations will not take effect\n")
diff --git a/util/port_test.go b/util/port_test.go
index 8c11537..5349dab 100644
--- a/util/port_test.go
+++ b/util/port_test.go
@@ -85,7 +85,7 @@ func TestDescribePortHolder(t *testing.T) {
// process on purpose. Both halves matter: the message has to name the port,
and
// the exit code has to be the one the supervisor treats as "do not restart".
func TestFatalListenError(t *testing.T) {
- if os.Getenv("CASWAF_TEST_FATAL_LISTEN") == "1" {
+ if os.Getenv("CASBIN_GATEWAY_TEST_FATAL_LISTEN") == "1" {
listener, err := ListenTcp(0)
if err != nil {
t.Fatalf("ListenTcp() error: %v", err)
@@ -103,7 +103,7 @@ func TestFatalListenError(t *testing.T) {
}
cmd := exec.Command(os.Args[0], "-test.run=TestFatalListenError")
- cmd.Env = append(os.Environ(), "CASWAF_TEST_FATAL_LISTEN=1")
+ cmd.Env = append(os.Environ(), "CASBIN_GATEWAY_TEST_FATAL_LISTEN=1")
output, err := cmd.CombinedOutput()
exitErr, ok := err.(*exec.ExitError)
diff --git a/util/supervisor.go b/util/supervisor.go
index e07b7ae..898de49 100644
--- a/util/supervisor.go
+++ b/util/supervisor.go
@@ -25,7 +25,7 @@ import (
const (
// EnvSupervisorKey is the environment variable key to detect if
running under supervisor
- EnvSupervisorKey = "CASWAF_SUPERVISED"
+ EnvSupervisorKey = "CASBIN_GATEWAY_SUPERVISED"
// MaxRestarts is the maximum number of restarts within the restart
window
MaxRestarts = 5
// RestartWindow is the time window for counting restarts
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]