brockwood / gostrufig Goto Github PK
View Code? Open in Web Editor NEWStruct focused config management for Go
License: MIT License
Struct focused config management for Go
License: MIT License
I can't get it to work.
Refactor the Etcd driver so that it exists outside of the main Gostrufig repo.
The initial checkin is void of any Godoc comments. Add those so we can be a better community library.
Clean up the Etcd code so that it works properly with nested structs.
Requested feature that non-zero'ed struct properties persist.
When persisting and retrieving values for a persistence layer, Gostrufig should support encrypting and decrypting values using PGP or similar mechanism.
I am testing out configs in the c2fo node and go baselines to see what features are missing in gull. There is a current mismatch between what gull puts into etcd for an array and what gostrufig reads into a struct.
Here's an example
func TestArrayParse(t *testing.T) {
type MyStruct struct {
ServiceHosts []string
}
blankStruct := MyStruct{}
os.Setenv("C2FO_SERVICEHOSTS", "[host1:6379, host2:6379]")
gostrufig := GetGostrufig("appname", "http://localhost:2379", nil)
gostrufig.setInitialStructValues(&blankStruct, "c2fo")
populatedStruct := MyStruct{
ServiceHosts: []string{
"host1:6379",
"host2:6379",
},
}
if reflect.DeepEqual(blankStruct, populatedStruct) {
t.Log("Blank and populated structs are the same.")
} else {
fmt.Printf("POP: [%+v]\n", populatedStruct)
fmt.Printf("LOD: [%+v]\n", blankStruct)
t.Errorf("Comparison of blank and populated structs failed.")
}
}
In gofigure all the values loaded into etcd are serialized JSON. However, gostrufig is expecting raw strings and then reflecting on them. Currently, gull can either store json encoded values or stringified values. Here is a golang array after it has been turned into a string.
"[host1:6379, host2:6379]"
@brockwood do you have any thoughts on how gostrufig can handle arrays? I assume gostrufig is the tool that would need tweaking, but if something else needs to be changed let me know.
I am currently thinking that gostrufig could have a naive array handler that splits the string and tries to parse the parts of the array using the reflection already present in gostrufig.
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.