Add the ability to include a CSS sheet link.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

The output page no states Package Set rather than just Package.
This commit is contained in:
Captain ALM 2022-07-12 11:16:03 +01:00
parent 012d464128
commit 2e5c296a7c
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
5 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import "golang.captainalm.com/GOPackageHeaderServer/outputMeta"
type ZoneYaml struct { type ZoneYaml struct {
Name string `yaml:"name"` Name string `yaml:"name"`
Domains []string `yaml:"domains"` Domains []string `yaml:"domains"`
CssURL string `yaml:"cssURL"`
HavePageContents bool `yaml:"havePageContents"` HavePageContents bool `yaml:"havePageContents"`
BasePath string `yaml:"basePath"` BasePath string `yaml:"basePath"`
UsernameProvided bool `yaml:"usernameProvided"` UsernameProvided bool `yaml:"usernameProvided"`

View File

@ -8,6 +8,7 @@ listen: #HTTP server settings
zones: #An array of zones zones: #An array of zones
- name: test #The name of the package set - name: test #The name of the package set
domains: ["localhost:8080"] #An array of domains this package set use (Each domain can only be registered with one zone) domains: ["localhost:8080"] #An array of domains this package set use (Each domain can only be registered with one zone)
cssURL: "http://localhost/sheet.css" #A URL to the CSS file to use for outputted pages (If blank or not provided, no CSS is included)
havePageContents: true #Output a header and link to the target repo havePageContents: true #Output a header and link to the target repo
basePath: "localhost" #The base-path, also known as, package name basePath: "localhost" #The base-path, also known as, package name
basePrefixURL: "http://localhost" #The base git URL basePrefixURL: "http://localhost" #The base git URL

View File

@ -1,8 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
{{ if .PageHandler.OutputPage }}
{{ if isNotEmpty .PageHandler.Name }} {{ if isNotEmpty .PageHandler.Name }}
<title>Go Package: {{ .PageHandler.Name }}</title> <title>Go Package Set: {{ .PageHandler.Name }}</title>
{{ end }}
{{ if isNotEmpty .PageHandler.CSS }}
<link rel="stylesheet" type="text/css" href="{{ .PageHandler.CSS }}">
{{ end }}
{{ end }} {{ end }}
<meta name="go-import" content="{{ .GetGoImportMetaContent }}"> <meta name="go-import" content="{{ .GetGoImportMetaContent }}">
<meta name="go-source" content="{{ .GetGoSourceMetaContent }}"> <meta name="go-source" content="{{ .GetGoSourceMetaContent }}">
@ -10,7 +15,7 @@
<body> <body>
{{ if .PageHandler.OutputPage }} {{ if .PageHandler.OutputPage }}
{{ if isNotEmpty .PageHandler.Name }} {{ if isNotEmpty .PageHandler.Name }}
<h1>Go Package: {{ .PageHandler.Name }}</h1> <h1>Go Package Set: {{ .PageHandler.Name }}</h1>
{{ end }} {{ end }}
<a href="{{ .GetLink }}">{{ .GetLink }}</a> <a href="{{ .GetLink }}">{{ .GetLink }}</a>
{{ end }} {{ end }}

View File

@ -10,6 +10,7 @@ import (
type PageHandler struct { type PageHandler struct {
Name string Name string
CSS string
OutputPage bool OutputPage bool
MetaOutput *outputMeta.PackageMetaTagOutputter MetaOutput *outputMeta.PackageMetaTagOutputter
} }

View File

@ -14,6 +14,7 @@ func New(yaml conf.ConfigYaml) (*http.Server, map[string]*PageHandler) {
for _, zc := range yaml.Zones { for _, zc := range yaml.Zones {
currentPage := &PageHandler{ currentPage := &PageHandler{
Name: zc.Name, Name: zc.Name,
CSS: zc.CssURL,
OutputPage: zc.HavePageContents, OutputPage: zc.HavePageContents,
MetaOutput: zc.GetPackageMetaTagOutputter(), MetaOutput: zc.GetPackageMetaTagOutputter(),
} }