v2.2.0
Features
-
Create project from scaffold #90
PyMS has a command line option to create a project template like Microservices Scaffold.
This command use cookiecutter to download and install this template
[Warning] You must run firstpip install cookiecutter==1.7.0
pyms startproject
this output a lot of options step by step:
project_repo_url [https://github.com/python-microservices/microservices-scaffold]: project_name [Python Microservices Boilerplate]: example project project_folder [example_project]: project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]: create_model_class [y]: microservice_with_swagger_and_connexion [y]: microservice_with_traces [y]: microservice_with_metrics [y]: application_root [/example_project]: Select open_source_license: 1 - MIT license 2 - BSD license 3 - ISC license 4 - Apache Software License 2.0 5 - GNU General Public License v3 6 - Not open source Choose from 1, 2, 3, 4, 5, 6 [1]:
When you finish to introduce the options, a project will be created in
[project_folder]
folder -
Encrypt/decrypt config (#86)
- New encryption and decryption feature with AES
- Create a key to encrypt config with new command line
pyms create-key
- Encrypt a string with the new command line
pyms encrypt [STRING]
- Set the key file with new environment variable
KEY_FILE
- If you set in your config a var with the prefix "ENC_" or "enc_" PyMS search for the key file and decrypt the string. Now you can encrypt your database url for production environments. I.E.:
pyms: [...] config: ENC_DATABASE: gAAAAABeSZ714r99iRIxhoH77vTdRJ0iqSymShfqgGN9PJveqhQWmshRDuV2a8sATey8_lHkln0TwezczucH-aJHGP_LyEiPxwM-88clNa7FB1u4g7Iaw3A=
you can access it in your code with
current_app.config["DATABASE"] == "http://database-url"
-
Human readable config errors #85
Show more help information if the config file not have a good structure with error messages likeConfig file must start with `pyms` keyword, for example: pyms: services: metrics: true requests: data: data swagger: path: "" file: "swagger.yaml" tracer: client: "jaeger" host: "localhost" component_name: "Python Microservice" config: DEBUG: true TESTING: true
-
Add service name label by default #84 - @alexppg
It adds a label to all jaeger's generated metrics that can be used to identify every microservice.
See jaegertracing/jaeger-client-python#269.
I messed up the previous PR, it's the same as this. #72
Fixes
- Send
path
toConfFile
fromMicroservice
class to set path from code if you want to not useCONFIGMAP_FILE
from env
Refactors
- Refactor config. Memoize of files moved to new class