sirkon / caddycfg Goto Github PK
View Code? Open in Web Editor NEWCaddy configuration reflection-based parser
License: MIT License
Caddy configuration reflection-based parser
License: MIT License
It turned out we need more control on arguments, see an example:
goproxy {
* goproxy https://something.org/repos
github.com/* direct
gitlab.stageoffice.ru/* storage A
}
the second column (goproxy, direct, storage) can only consists of these three words, everything else is prohibited. We must control it on parsing and once something else was found must report an exact position of the mistake.
The idea is to introduce special interface
type ArgumentParser interface {
AppendArgument(arg string) error
Arguments() []string
}
AppendArgument
is to be used for argument consumption. Returned error will cause parsing error pointing to token location.
Let we have the following config:
A 1 2 3 {
a 1
}
B a b c {
a 1
}
Let we have the following structure
type destStruct struct {
caddycfg.Args
A int
}
Then the variable
var dest map[string]destStruct
should be perfectly fine for parsing given config into. But it gives an error now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.