Skip to content

A simple CLI to divide small file into blocks of environment variables and back

License

Notifications You must be signed in to change notification settings

VPKSoftOrg/FileToVariables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FileToVariables

A small CLI tool to split small files into base64 blocks and read and combine base64 blocks from environment variables into the original file data.

Suitable for storing files into CI/CD variables, e.g. certificates.

Release Rust

.\FileToVariables.exe --help:

A simple program to encode data to base64 and decode it back

Usage: FileToVariables.exe [OPTIONS] --file <FILE> --var-format <VAR_FORMAT> <COMMAND>

Commands:
  read   Reads the variables from environment variables and writes them to a file
  write  Writes the variables from a file to environment variables
  help   Print this message or the help of the given subcommand(s)

Options:
  -f, --file <FILE>                    File to read the data from
  -v, --var-format <VAR_FORMAT>        The format of the environment variable. E.g. "data_xyz{i}"
  -b, --block <BLOCK>                  The base64 block size. This indicates how many bytes are used in a base64 block
      --shell-flavour <SHELL_FLAVOUR>  The optional shell-flavour to use in case the data is written to an environment variable. Allowed values: powershell, cmd, bash [possible values: power-shell, bash, cmd]
  -h, --help                           Print help
  -V, --version                        Print version

.\FileToVariables.exe --file ../../LICENSE --var-format "dataxyz{i}" --block 400 write:

dataxyz01=TUlUIExpY2Vuc2UKCkNvcHlyaWdodCAoYykgMjAyNCBWUEtTb2Z0T3JnCgpQZXJtaXNzaW9uIGlzIGhlcmVieSBncmFudGVkLCBmcmVlIG9mIGNoYXJnZSwgdG8gYW55IHBlcnNvbiBvYnRhaW5pbmcgYSBjb3B5Cm9mIHRoaXMgc29mdHdhcmUgYW5kIGFzc29jaWF0ZWQgZG9jdW1lbnRhdGlvbiBmaWxlcyAodGhlICJTb2Z0d2FyZSIpLCB0byBkZWFsCmluIHRoZSBTb2Z0d2FyZSB3aXRob3V0IHJlc3RyaWN0aW9uLCBpbmNsdWRpbmcgd2l0aG91dCBsaW1pdGF0aW9uIHRoZSByaWdodHMKdG8gdXNlLCBjb3B5LCBtb2RpZnksIG1l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ENSE_NEW --var-format "dataxyz{i}" read: → We get the MIT license from the environment variables back.

Thanks to:

About

A simple CLI to divide small file into blocks of environment variables and back

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages