Skip to main content

Eureka Templating Library

Project description

About

eureka_template - library to generate files from eureka information

This library helps you generate files based on jinja2 templates based on information retrieved from Eureka

Installation

eureka_template can be installed using the pip distribution system for python by issuing:

$ pip install eureka_template

Alternatively, you can run use setup.py to install by cloning this repository and issuing:

# python setup.py install

Examples

Create a file named template.conf.tmpl:

[
{% for app in apps %}
  {
  "name": "{{ app.name }}",
  "instances": [
  {% for instance in app.instances %}
    {
    "hostName": "{{ instance.hostname }}",
    "port": {{ instance.port }}
    }{% if not loop.last %},{% endif %}
  {% endfor %}
  ]
  }{% if not loop.last %},{% endif %}
{% endfor %}
]

Then execute:

eureka-template -e http://eureka.example.com/eureka/v2/ \
-t template.conf.tmpl \
-o /dev/stdout

You’ll see your template filled with data on the screen.

It will keep running and polling eureka and will generate a new template any time there’s a change.

You can specify a command to execute whenever the template is generated by using the -c flag

eureka-template -e http://eureka.example.com/eureka/v2/ \
-t template.conf.tmpl \
-o /dev/stdout
-c "echo hi"

You can also run it and exit immediately:

eureka-template -e http://eureka.example.com/eureka/v2/ \
-t template.conf.tmpl \
-o /dev/stdout \
-c "echo hi" \
--once

Licensing

eureka_template is licensed under the Apache License 2.0. See LICENSE for the eureka_template full license text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eureka_template-0.0.5.dev0.tar.gz (7.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page