Giter Club home page Giter Club logo

tms's Introduction

Simple Talos Metadata Service

This is a simple HTTP service that listens on MDS_LISTEN (defaults to 127.0.0.1:8088) to respond with YAML files based on the MAC address in the request. The service will respond with a corresponding YAML file if it is found in the MDS_CONFIG_DIR (defaults to ./configs) directory otherwise it will return 404 not found.

Setup

There are two environmental variables that can be set to change the behavior of the service.

  • MDS_CONFIG_DIR - The directory to look for YAML files in. Defaults to ./configs.
  • MDS_LISTEN - The address and port to listen on. Defaults to 127.0.01:8088.
  • MDS_LOG_LEVEL - The log level to use. Defaults to info.

The service will look for a YAML file with the name of the MAC address in the MDS_CONFIG_DIR directory. For example, if the MAC address is 6c:4b:90:26:e4:4d then the service will look for a file named 6c4b9026e44d.yaml in the MDS_CONFIG_DIR directory. If the file is found then the contents of the file will be returned. If the file is not found then a 404 not found will be returned.

Usage

$ MDS_LOG_LEVEL=debug MDS_LISTEN=0.0.0.0:1234 MDS_CONFIG_DIR=/path/to/configs ./metadata-service
DEBU[0000] Log level set to debug
DEBU[0000] Listen interface: 0.0.0.0:1234
DEBU[0000] Config directory: /path/to/configs
INFO[0000] Starting Talos Metadata Config Service
INFO[0000] Listening on 0.0.0.0:1234
DEBU[0014] Raw MAC: aa:bb:cc:00:11:22
DEBU[0014] Sanitized MAC aabbcc001122
INFO[0014] Attempting to load from /path/to/configs/aabbcc001122.yaml
ERRO[0014] Config file not found: open /path/to/configs/aabbcc001122.yaml: no such file or directory

$ curl 'localhost:1234/talos/config?mac=aa:bb:cc:00:11:22'
Not Found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.