Skip to content

Commit 549ae21

Browse files
committed
ADD: Documentation
1 parent bb4aeca commit 549ae21

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

README.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@ The GIT-HttpServer only support basic authentication on repositories by protocol
1616
## Configuration
1717

1818
### Environment Variables
19-
| Name | Description | Default | Mandatory |
20-
|--------------------|----------------------------------------------------------|---------------------------------------------------|-----------|
21-
| PATH_CLONE | Set clone path | _clone | Yes |
22-
| PATH_PULL | Set pull path | _pull | Yes |
23-
| PATH_VERSION | Set get git commit version path | _version | Yes |
24-
| PATH_WEBHOOK | Set webhook path | _hook | Yes |
25-
| PATH_HEALTH | Set health check path | _health | Yes |
26-
| REPO_BRANCH | Set default branch to clone content | main | Yes |
27-
| REPO_TARGET_FOLDER | Set folder to clone source | target-git | Yes |
28-
| REPO_URL | Set url as a source origin | https://github.com/jarpsimoes/git-http-server.git | Yes |
29-
| REPO_USERNAME | Set username or token identifier to basic authentication | N/D | No |
30-
| REPO_PASSWORD | Set password or token to basic authentication | N/D | No |
31-
| HTTP_PORT | Set port to expose content | 8081 | Yes |
32-
19+
| Name | Description | Default | Mandatory |
20+
|---------------------------|----------------------------------------------------------|---------------------------------------------------|-----------|
21+
| PATH_CLONE | Set clone path | _clone | Yes |
22+
| PATH_PULL | Set pull path | _pull | Yes |
23+
| PATH_VERSION | Set get git commit version path | _version | Yes |
24+
| PATH_WEBHOOK | Set webhook path | _hook | Yes |
25+
| PATH_HEALTH | Set health check path | _health | Yes |
26+
| REPO_BRANCH | Set default branch to clone content | main | Yes |
27+
| REPO_TARGET_FOLDER | Set folder to clone source | target-git | Yes |
28+
| REPO_URL | Set url as a source origin | https://github.com/jarpsimoes/git-http-server.git | Yes |
29+
| REPO_USERNAME | Set username or token identifier to basic authentication | N/D | No |
30+
| REPO_PASSWORD | Set password or token to basic authentication | N/D | No |
31+
| HTTP_PORT | Set port to expose content | 8081 | Yes |
32+
| GHS_CUSTOM_PATH_<path> | Custom path to work as a proxy server | N/D | No |
33+
| GHS_CUSTOM_REWRITE_<path> | Set to remove from proxy request base path | N/D | No |
3334

3435
## Implementation
3536

@@ -68,6 +69,26 @@ $ docker run \
6869
jarpsimoes/git_http_server
6970
```
7071

72+
### Implementation with Proxy redirect
73+
74+
Git Http Server support routes to redirect for another URL. Should be defined path to redirect and target.
75+
The environment variables must be defined as bellow:
76+
77+
- GHS_CUSTOM_PATH_example/path/redirect: "https://example.org"
78+
- GHS_CUSTOM_REWRITE_example/path/redirect: true # If you need remove the "example/path/redirect" from the proxy request must be defined:
79+
80+
```shell
81+
$ docker run \
82+
-p 8081:8081 \
83+
-e REPO_URL=[URL REPOSITORY] \
84+
-e REPO_BRANCH=[DEFAULT BRANCH] \
85+
-e REPO_USERNAME=[Token Identifier or Username] \
86+
-e REPO_PASSWORD=[Password or Token] \
87+
-e GHS_CUSTOM_PATH_google/redirect=https://www.google.pt
88+
-e GHS_CUSTOM_REWRITE_google/redirect=true
89+
jarpsimoes/git_http_server
90+
```
91+
7192
Test content
7293
```shell
7394
$ curl http://localhost:8080

src/utils/custom_path.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func GetAllCustomPaths() *[]CustomPath {
4747
if strings.HasPrefix(newPath, "/") {
4848
newPath = newPath[1:len(newPath)]
4949
}
50+
5051
if len(splitVar) > 1 {
5152
varObject := CustomPath{
5253
path: strings.ReplaceAll(newPath, ".", "/"),

0 commit comments

Comments
 (0)