🔧 Removed StaticURLPrefix config

develop
Maxim Lebedev 2 weeks ago
parent fb93202373
commit c42bef9895
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5

@ -29,7 +29,6 @@ type (
Port string `env:"PORT" envDefault:"3000"`
Protocol string `env:"PROTOCOL" envDefault:"http"`
RootURL string `env:"ROOT_URL" envDefault:"{{protocol}}://{{domain}}:{{port}}/"`
StaticURLPrefix string `env:"STATIC_URL_PREFIX"`
}
ConfigDatabase struct {
@ -92,7 +91,6 @@ func TestConfig(tb testing.TB) *Config {
Port: "3000",
Protocol: "http",
RootURL: "{{protocol}}://{{domain}}:{{port}}/",
StaticURLPrefix: "/static",
},
Database: ConfigDatabase{
Type: "memory",
@ -128,10 +126,9 @@ func (cs ConfigServer) GetAddress() string {
// GetRootURL returns generated root URL from template RootURL.
func (cs ConfigServer) GetRootURL() string {
return fasttemplate.ExecuteString(cs.RootURL, `{{`, `}}`, map[string]any{
"domain": cs.Domain,
"host": cs.Host,
"port": cs.Port,
"protocol": cs.Protocol,
"staticUrlPrefix": cs.StaticURLPrefix,
"domain": cs.Domain,
"host": cs.Host,
"port": cs.Port,
"protocol": cs.Protocol,
})
}

@ -133,7 +133,7 @@ func init() {
logger.Fatalln("cannot parse root URL as client URL:", err)
}
if indieAuthClient.Logo[0], err = url.Parse(rootURL + config.Server.StaticURLPrefix + "/icon.svg"); err != nil {
if indieAuthClient.Logo[0], err = url.Parse(rootURL + "icon.svg"); err != nil {
logger.Fatalln("cannot parse root URL as client URL:", err)
}

@ -39,18 +39,18 @@ en
{% func (p *BaseOf) Head() %}
{% comment %}https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs{% endcomment %}
<link rel="icon"
href="{%s p.Config.Server.StaticURLPrefix %}/favicon.ico"
href="/favicon.ico"
sizes="any">
<link rel="icon"
href="{%s p.Config.Server.StaticURLPrefix %}/icon.svg"
href="/icon.svg"
type="image/svg+xml">
<link rel="apple-touch-icon"
href="{%s p.Config.Server.StaticURLPrefix %}/apple-touch-icon.png">
href="/apple-touch-icon.png">
<link rel="manifest"
href="{%s p.Config.Server.StaticURLPrefix %}/manifest.webmanifest">
href="/manifest.webmanifest">
{% endfunc %}
{% func (p *BaseOf) Body() %}{% endfunc %}

@ -152,23 +152,7 @@ func (p *BaseOf) StreamHead(qw422016 *qt422016.Writer) {
//line web/baseof.qtpl:39
qw422016.N().S(` `)
//line web/baseof.qtpl:40
qw422016.N().S(` <link rel="icon" href="`)
//line web/baseof.qtpl:42
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:42
qw422016.N().S(`/favicon.ico" sizes="any"> <link rel="icon" href="`)
//line web/baseof.qtpl:46
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:46
qw422016.N().S(`/icon.svg" type="image/svg+xml"> <link rel="apple-touch-icon" href="`)
//line web/baseof.qtpl:50
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:50
qw422016.N().S(`/apple-touch-icon.png"> <link rel="manifest" href="`)
//line web/baseof.qtpl:53
qw422016.E().S(p.Config.Server.StaticURLPrefix)
//line web/baseof.qtpl:53
qw422016.N().S(`/manifest.webmanifest"> `)
qw422016.N().S(` <link rel="icon" href="/favicon.ico" sizes="any"> <link rel="icon" href="/icon.svg" type="image/svg+xml"> <link rel="apple-touch-icon" href="/apple-touch-icon.png"> <link rel="manifest" href="/manifest.webmanifest"> `)
//line web/baseof.qtpl:54
}

Loading…
Cancel
Save