Created
July 14, 2015 20:25
-
-
Save anonymous/7834ddca3be025319b97 to your computer and use it in GitHub Desktop.
nginx urlshortener with confd and etcd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name mydomain.com; | |
{{range gets "/shorteners/*"}} | |
location /{{.Key}} { | |
return 302 {{.Value}}; | |
} | |
{{end}} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[template] | |
# The name of the template that will be used to render the application's configuration file | |
# Confd will look in `/etc/conf.d/templates` for these files by default | |
src = "dashboard.tmpl" | |
# The location to place the rendered configuration file | |
dest = "/etc/nginx/nginx.conf" | |
# The etcd keys or directory to watch. This is where the information to fill in | |
# the template will come from. | |
keys = [ "/shorteners/*" ] | |
# File ownership and mode information | |
owner = "root" | |
mode = "0644" | |
# These are the commands that will be used to check whether the rendered config is | |
# valid and to reload the actual service once the new config is in place | |
check_cmd = "/usr/sbin/service nginx configtest" | |
reload_cmd = "/usr/sbin/service nginx reload" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment