Package: secretfy-config-creator
Secretfy-config-creator is a tool for creating configuration files from
existing template files.ContentsTable of Contents:ContentsWhat is Secretfy-config-creator?Why Secretfy-config-creator?InstallationHow to UseSamplesFAQSupportLicenseWhat is Secretfy-config-creator?Secretfy-config-creator is a tool for generating config files dynamically from
your template files. The templates are nothing but configuration files, which
holds your configuration in mustache format. The secretfy-config-creator tool
generator the required configuration file with help of secrets file which would
contain the real values required for actual config/properties file.Why Secretfy-config-creator?Let’s just say you have a set of configuration which you keep in a file
config.yaml, config.json, application.properties etc. These configuration might
have some highly sensitive information required to execute your project like
your user credentials, email, phone number, private key etc. Everytime, in your
development process, you need to add these sensitive values to the config file
and remove them before committing the code into github.This process is pretty painful and often you endup committing one or the other
sensitive information to git.So, instead of having a config file, you can have a template which resembles
your config file. Now before executing your project. All you need to do is
generate the desired config file with the help of this tool and then follow the
usual approach of running the project. The best part is that you don’t have to
worry about accidently commit the actual config file to the git repo. That file
won’t be shown in git status unless you forcibly add it.InstallationThis section provides quick steps of how to setup this tool.Create a virtual Python environment and install Secretfy-config-creator in it.virtualenvvsecretfysourcevsecretfy/bin/activatepython3setup.pyinstallRun Sanity testsecretfy-mThe above command creates mock templates, secrets file at/tmp/secretfy-config-creatordirectory. The-cor--configoption is for providing your config.yaml file.How to UseThis section provides samples of how to use this tool.Secretfy-config-creator consist of 3 components :-Secrets file- This file can be in yaml, json and xml format.Template files- These files are configuration files in template format. For
eg:- If you have a fileconfig.jsonthen your template file will beconfig.json.mustache.Extension- This is the file extension of your configuration file. Following
are the example config files and their respective extension.a.config.yaml:yamlb.config.xml:xmlc.config.json:jsond.config.properties:propertiesThese parameters can be added to abaseconfig.yamlfile in the following waysecretfy_template:secret:res/secrets.yamltemplates:-file:res/example.yaml.mustacheextension:yaml-file:res/example.json.mustacheextension:json-file:res/example.xml.mustacheextension:xmlThebaseconfig.yamlfile starts withsecretfy_templatetag.1.secretis the absolute path of the secrets file containing sensitive
values.2.templatestag is an array of template files. All these files are in.mustacheformat whose sensitive values resides insecrets.yamlfile.fileis the absolute path of the template file.extensionis the extension of the configuration file which will be generated from the template file.NOTE: Make sure that the template file are in<file_name>.<extension>.<mustache>format.Run the following command to generate the config files.secretfy-cbaseconfig.yamlThis will create config files in the respective directories. Note that these
configurations won’t be seen in git history. You can check that by doinggit status.Samplessecrets.yamlsecrets:item:val1:foo@bar.comval2:my_passworditem1:val3:usernameval4:my_private_keyexample.yaml.mustachesecrets:item:val1:{{secrets.item.val1}}val2:{{secrets.item.val2}}result:Thisisjustadummydescription.item1:val3:{{secrets.item1.val3}}val4:{{secrets.item1.val4}}result:Thisisanotherdummydescription.Thesecrets.yamlfile contains the sensitive information andexample.yaml.mustacheis the template file which contains the keys inmustacheformat. Hence the keysecrets.item.val2has valuemy_passwordwhich will be populated viasecretfytool.NOTE: You can run `secretfy-m`to get more sample baseconfig, templates, secret files. These files will get generated at`/tmp/secretfy-config-creator`.FAQHow can i deploy my code in CICD pipeline or on remote server since it
doesn’t have config files and needs to be generated.You can generate all the config files required for your repository to compile
and run in CICD pipeline or at remote server by the following command.secretfy-emustache-s<secrets_file_path>-r<repository_path>-eis the template extension,-sis the absolute path of the secrets file
and-ris absolute path of the repositorySupportTo report bugs, suggest improvements, or ask questions, please create a
new issue athttps://github.com/sunnysharmagts/Secretfy-config-creator/issues.LicenseThis is free software. You are permitted to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of it, under the
terms of the MIT License. SeeLICENSE.mdfor the complete license.This software is provided WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SeeLICENSE.mdfor the complete disclaimer.