Comments (5)
(Known issue - the line number in the panic message is +2 the actual, so line 64 is actual source of panic. Still not sure why the line number is off.)
I thought I fixed this with commit 8ea98f8 - have you pulled the latest recently? (go get -u github.com/mholt/caddy
should do it)
from caddy.
Unfortunately, I get the described effect with the latest HEAD ...
I added debug statements to the load
method (metadata.go
) ...
func (m *Metadata) load(parsedMap map[string]interface{}) {
fmt.Printf("-- %v\n", parsedMap)
if template, ok := parsedMap["title"]; ok {
m.Title, _ = template.(string)
}
if template, ok := parsedMap["template"]; ok {
m.Template, _ = template.(string)
}
if variables, ok := parsedMap["variables"]; ok {
fmt.Printf("-- %v\n", reflect.TypeOf(variables))
vars, ok := variables.(map[string]interface{})
m.Variables = vars
fmt.Printf("-- %v - %v\n", vars, ok)
}
}
... and get the following output:
(YAML)
-- map[template:default variables:[map[title:Test]]]
-- []interface {}
-- map[] - false
(TOML)
-- map[template:default variables:map[title:Test]]
-- map[string]interface {}
-- map[title:Test] - true
yaml.Unmarshal
(in Parse
of YAMLMetadataParser
) seems to return something unexpected.
I might have some more time tomorrow for more debugging.
from caddy.
Thanks for testing this out.
I have seen the issue, the fix should be out soon.
Firstly, the YAML syntax used for variables -
is for a list and not an object. Only indentation is the requirement for a nested objected. (I am also guilty of this).
Should be
---
template: default
variables:
title: Test
---
Secondly, the yaml package decodes nested maps into a map[interface{}]interface{}
and I was assuming a map[string]interface{}
.
Thanks.
from caddy.
@mschoebel The fix has been merged. Let us know if it works now.
Thanks.
from caddy.
Works. 👍
YAML is weird.
from caddy.
Related Issues (20)
- automatic http->https redirect not enabled on multiple bind addresses HOT 2
- Remove support for lego-deprecated
- IP is set but cannot be accessed HOT 1
- Duplicate strings.Count in path matcher HOT 1
- New Release Needed HOT 3
- IP passthrough issue HOT 3
- fileserver: grid view - preview img src attribute is not URL query-escaped HOT 3
- Caddy ignoring system proxy when doing ACME requests HOT 2
- Download crawl or stall HOT 2
- Caddy does not report version # HOT 3
- Caddy missing patches HOT 1
- What happens when multiple root directives with intersecting matchers are specified in a block? HOT 1
- Feature Request: remote_host request matcher HOT 3
- on_demand ask cache instead of rate_limit HOT 3
- Caddy is not stopping HOT 4
- Tailscale certificate is not found when email is specified HOT 3
- logs.skip_hosts is ignored HOT 12
- Placeholders do not work as upstream address for reverse_proxy HOT 2
- How can Caddy Server automatically switch over the next upstream server when it encounters an unhealthy HTTP status code during load balancing? HOT 1
- Getting real ip on docker HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caddy.