Name: gophersiesta
Owner: gophergala2016
Description: A manager/service for configurations files, properties placeholders and their values separated by application and namespaces that will make your live easier
Created: 2016-01-22 19:22:09.0
Updated: 2016-02-14 21:39:25.0
Pushed: 2016-01-24 22:59:15.0
Size: 2065
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A manager/service for configurations files, properties placeholders and their values separated by application and namespaces. GopherSiesta is composed of two parts, a server and an example command line client to communicate with the server's API.
The goal of GopherSiesta is to make it easier to manage the configurations of all your services following the 12 factor app best practices. GopherSiesta client will run prior to your application and fetch the corresponding configuration for your service.
Currently the values for the placeholders for a given set of labels can be stored in:
As the project uses godep to make builds reproducibly
go get github.com/gophergala2016/gophersiesta
md/gophersiesta-server
un main.go
ash
-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
sing env: export GIN_MODE=release
sing code: gin.SetMode(gin.ReleaseMode)
-debug] GET / --> github.com/gophergala2016/gophersiesta/server/handlers.GetHome (3 handlers)
-debug] GET /conf/:appname --> github.com/gophergala2016/gophersiesta/server/handlers.GetConfig (3 handlers)
-debug] GET /conf/:appname/placeholders --> github.com/gophergala2016/gophersiesta/server/handlers.GetPlaceHolders (3 handlers)
-debug] GET /conf/:appname/values --> github.com/gophergala2016/gophersiesta/server/handlers.GetValues.func1 (3 handlers)
-debug] POST /conf/:appname/values --> github.com/gophergala2016/gophersiesta/server/handlers.SetValues.func1 (3 handlers)
-debug] GET /conf/:appname/render/:format --> github.com/gophergala2016/gophersiesta/server/handlers.ReplacePlaceholders.func1 (3 handlers)
-debug] GET /conf/:appname/labels --> github.com/gophergala2016/gophersiesta/server/handlers.GetLabels.func1 (3 handlers)
: No PORT environment variable detected, defaulting to 4747
-debug] Listening and serving HTTP on :4747
://gophersiesta.herokuapp.com/conf/:appname
Retrieve the full template file for the application.
Example
http://gophersiesta.herokuapp.com/conf/app1
ication:
name: "App1"
version: 0.0.1
source:
url: ${DATASOURCE_URL:jdbc:mysql://localhost:3306/shcema?profileSQL=true} # has default value
username: ${DATASOURCE_USERNAME} # has no default value. If no value is passed should producer error if validated
password: ${DATASOURCE_PASSWORD}
Get the list of all possible variables of the template.
://gophersiesta.herokuapp.com/conf/:appname/placeholders
Example
http://gophersiesta.herokuapp.com/conf/app1/placeholders
laceholders": [
{
"placeholder": "DATASOURCE_URL",
"property_value": "${DATASOURCE_URL:jdbc:mysql://localhost:3306/shcema?profileSQL=true}",
"property_name": "datasource.url"
},
{
"placeholder": "DATASOURCE_USERNAME",
"property_value": "${DATASOURCE_USERNAME}",
"property_name": "datasource.username"
},
{
"placeholder": "DATASOURCE_PASSWORD",
"property_value": "${DATASOURCE_PASSWORD}",
"property_name": "datasource.password"
}
Get the values that are going to be used to generate the template. Labels override previous values.
://gophersiesta.herokuapp.com/conf/:appname/values?labels=:label1,:label2
Example
http://gophersiesta.herokuapp.com/conf/app1/values
"values": [
{
"name": "DATASOURCE_PASSWORD",
"value": "FOOBAR"
},
{
"name": "DATASOURCE_USERNAME",
"value": "GOPHER"
}
]
http://gophersiesta.herokuapp.com/conf/app1/values?labels=dev
"values": [
{
"name": "DATASOURCE_PASSWORD",
"value": "LOREM"
},
{
"name": "DATASOURCE_USERNAME",
"value": "GOPHER-dev"
}
]
http://gophersiesta.herokuapp.com/conf/app1/values?labels=prod
"values": [
{
"name": "DATASOURCE_PASSWORD",
"value": "IPSUM"
},
{
"name": "DATASOURCE_URL",
"value": "jdbc:mysql://proddatabaseserver:3306/shcema?profileSQL=true"
},
{
"name": "DATASOURCE_USERNAME",
"value": "GOPHER-prod"
}
]
http://gophersiesta.herokuapp.com/conf/app1/values?labels=dev,prod
"values": [
{
"name": "DATASOURCE_PASSWORD",
"value": "IPSUM"
},
{
"name": "DATASOURCE_USERNAME",
"value": "GOPHER-prod"
},
{
"name": "DATASOURCE_URL",
"value": "jdbc:mysql://proddatabaseserver:3306/shcema?profileSQL=true"
}
]
http://gophersiesta.herokuapp.com/conf/app1/values?labels=prod,dev
"values": [
{
"name": "DATASOURCE_URL",
"value": "jdbc:mysql://proddatabaseserver:3306/shcema?profileSQL=true"
},
{
"name": "DATASOURCE_USERNAME",
"value": "GOPHER-dev"
},
{
"name": "DATASOURCE_PASSWORD",
"value": "LOREM"
}
]
Get the list of all possible variables of the template.
://gophersiesta.herokuapp.com/conf/:appname/labels
Example
http://gophersiesta.herokuapp.com/conf/app1/labels
abels": [
"default",
"dev",
"prod"
Render replaces the placeholders with the previously stored values. Depending on the provided labels different files, will be rendered
://gophersiesta.herokuapp.com/conf/:appname/render/yml
Example
://gophersiesta.herokuapp.com/conf/app1/render/yml
ication:
me: App1
rsion: 0.0.1
source:
ssword: FOOBAR
l: jdbc:mysql://localhost:3306/shcema?profileSQL=true
ername: GOPHER
aml
http://gophersiesta.herokuapp.com/conf/app1/render/yml?labels=dev
ication:
me: App1
rsion: 0.0.1
source:
ssword: dev_password
l: dev_url
ername: dev_user
aml
http://gophersiesta.herokuapp.com/conf/app1/render/yml?labels=prod
ication:
me: App1
rsion: 0.0.1
source:
ssword: IPSUM
l: jdbc:mysql://proddatabaseserver:3306/shcema?profileSQL=true
ername: GOPHER-prod
All the API operations are available through a command line APP, because we gophers love the command line.
The best way to explain the functionality is seeing it action:
In this gif you can see:
In this gif you can see:
In this gif you can see:
The Gopher character is based on the Go mascot designed by Renée French and copyrighted under the Creative Commons Attribution 3.0 license.