mirror of
https://github.com/simongregorebner/gitea-pages.git
synced 2025-04-21 02:10:02 +02:00
add option to either use fixed org repo or use github style nameing
This commit is contained in:
parent
28b9ac94f5
commit
0842be001b
@ -1,6 +1,6 @@
|
|||||||
FROM caddy:builder-alpine AS builder
|
FROM caddy:builder-alpine AS builder
|
||||||
|
|
||||||
RUN xcaddy build --with github.com/simongregorebner/gitea-pages@v0.0.5
|
RUN xcaddy build --with github.com/simongregorebner/gitea-pages@v0.0.6
|
||||||
|
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
@ -89,7 +89,8 @@ log {
|
|||||||
| server | The URL of your Gitea server. |
|
| server | The URL of your Gitea server. |
|
||||||
| token | Your access token for the Gitea API. This token is used to authenticate requests made to the Gitea server.|
|
| token | Your access token for the Gitea API. This token is used to authenticate requests made to the Gitea server.|
|
||||||
| pages_branch | The branch in your repository that contains the static files for your website or documentation. By default, this would be the branch "gitea-pages" |
|
| pages_branch | The branch in your repository that contains the static files for your website or documentation. By default, this would be the branch "gitea-pages" |
|
||||||
| postfix_pages_repository | The (domain) postfix used for the pages repository. (This could be the domain where your site will be accessible, such as "gitea.io".) |
|
| pages_repository | The default repository of an organization |
|
||||||
|
| postfix_pages_repository | The (domain) postfix used for the pages repository. __This setting is only used if pages_repository is not set!__ (This could be the domain where your site will be accessible, such as "gitea.io".) |
|
||||||
| url_scheme | The URL scheme to use for the pages. "simple" or "classic |
|
| url_scheme | The URL scheme to use for the pages. "simple" or "classic |
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ type GiteaPagesModule struct {
|
|||||||
Server string `json:"server,omitempty"`
|
Server string `json:"server,omitempty"`
|
||||||
Token string `json:"token,omitempty"`
|
Token string `json:"token,omitempty"`
|
||||||
PagesBranch string `json:"pages_branch,omitempty"`
|
PagesBranch string `json:"pages_branch,omitempty"`
|
||||||
|
PagesRepository string `json:"pages_repository,omitempty"`
|
||||||
PostfixPagesRepository string `json:"postfix_pages_repository,omitempty"`
|
PostfixPagesRepository string `json:"postfix_pages_repository,omitempty"`
|
||||||
URLScheme string `json:"url_scheme,omitempty"`
|
URLScheme string `json:"url_scheme,omitempty"`
|
||||||
}
|
}
|
||||||
@ -65,6 +66,8 @@ func (module *GiteaPagesModule) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
|
|||||||
d.Args(&module.Token)
|
d.Args(&module.Token)
|
||||||
case "pages_branch":
|
case "pages_branch":
|
||||||
d.Args(&module.PagesBranch)
|
d.Args(&module.PagesBranch)
|
||||||
|
case "pages_repository":
|
||||||
|
d.Args(&module.PagesBranch)
|
||||||
case "postfix_pages_repository":
|
case "postfix_pages_repository":
|
||||||
d.Args(&module.PostfixPagesRepository)
|
d.Args(&module.PostfixPagesRepository)
|
||||||
case "url_scheme":
|
case "url_scheme":
|
||||||
@ -76,9 +79,11 @@ func (module *GiteaPagesModule) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
|
|||||||
if module.PagesBranch == "" {
|
if module.PagesBranch == "" {
|
||||||
module.PagesBranch = "gitea-pages"
|
module.PagesBranch = "gitea-pages"
|
||||||
}
|
}
|
||||||
|
if module.PagesRepository == "" {
|
||||||
if module.PostfixPagesRepository == "" {
|
if module.PostfixPagesRepository == "" {
|
||||||
module.PostfixPagesRepository = "gitea-pages"
|
module.PostfixPagesRepository = "gitea-pages"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if module.URLScheme == "" {
|
if module.URLScheme == "" {
|
||||||
module.URLScheme = "simple"
|
module.URLScheme = "simple"
|
||||||
@ -131,9 +136,13 @@ func (module GiteaPagesModule) ServeHTTP(writer http.ResponseWriter, request *ht
|
|||||||
// Case http(s)://<organization>.<giteaserver>[:<port>]
|
// Case http(s)://<organization>.<giteaserver>[:<port>]
|
||||||
// (Try to) Use of the pages repository in the specified organization
|
// (Try to) Use of the pages repository in the specified organization
|
||||||
|
|
||||||
|
// Determine name of the default repository for organization based on settings
|
||||||
|
if module.PagesRepository != "" {
|
||||||
|
repository = module.PagesRepository
|
||||||
|
} else {
|
||||||
// We use github.com conventions: <organization>.github.io
|
// We use github.com conventions: <organization>.github.io
|
||||||
// repository = organization + "." + module.PostfixPagesRepository
|
repository = organization + "." + module.PostfixPagesRepository
|
||||||
repository = module.PostfixPagesRepository
|
}
|
||||||
path = "index.html"
|
path = "index.html"
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -153,9 +162,13 @@ func (module GiteaPagesModule) ServeHTTP(writer http.ResponseWriter, request *ht
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// (Try to) Use of the pages repository in the specified organization
|
// (Try to) Use of the pages repository in the specified organization
|
||||||
|
// Determine name of the default repository for organization based on settings
|
||||||
|
if module.PagesRepository != "" {
|
||||||
|
repository = module.PagesRepository
|
||||||
|
} else {
|
||||||
// We use github.com conventions: <organization>.github.io
|
// We use github.com conventions: <organization>.github.io
|
||||||
// repository = organization + "." + module.PostfixPagesRepository
|
repository = organization + "." + module.PostfixPagesRepository
|
||||||
repository = module.PostfixPagesRepository
|
}
|
||||||
path = strings.Join(parts[0:], "/")
|
path = strings.Join(parts[0:], "/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user