Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vpksoftorg/filetovariables
A simple CLI to divide small file into blocks of environment variables and back
https://github.com/vpksoftorg/filetovariables
ci ci-cd cli environment-variables files
Last synced: about 2 months ago
JSON representation
A simple CLI to divide small file into blocks of environment variables and back
- Host: GitHub
- URL: https://github.com/vpksoftorg/filetovariables
- Owner: VPKSoftOrg
- License: mit
- Created: 2024-09-01T09:04:20.000Z (4 months ago)
- Default Branch: develop
- Last Pushed: 2024-09-17T03:32:43.000Z (4 months ago)
- Last Synced: 2024-09-17T06:50:17.079Z (4 months ago)
- Topics: ci, ci-cd, cli, environment-variables, files
- Language: Rust
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/VPKSoftOrg/FileToVariables/actions/workflows/release.yml/badge.svg)](https://github.com/VPKSoftOrg/FileToVariables/actions/workflows/release.yml) [![Rust](https://github.com/VPKSoftOrg/FileToVariables/actions/workflows/rust.yml/badge.svg)](https://github.com/VPKSoftOrg/FileToVariables/actions/workflows/rust.yml)
`.\FileToVariables.exe --help`:
```
A simple program to encode data to base64 and decode it backUsage: FileToVariables.exe [OPTIONS] --file --var-format
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 to read the data from
-v, --var-format The format of the environment variable. E.g. "data_xyz{i}"
-b, --block The base64 block size. This indicates how many bytes are used in a base64 block
--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=TUlU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E5PTklORlJJTg==
dataxyz03=R0VNRU5ULiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUKQVVUSE9SUyBPUiBDT1BZUklHSFQgSE9MREVSUyBCRSBMSUFCTEUgRk9SIEFOWSBDTEFJTSwgREFNQUdFUyBPUiBPVEhFUgpMSUFCSUxJVFksIFdIRVRIRVIgSU4gQU4gQUNUSU9OIE9GIENPTlRSQUNULCBUT1JUIE9SIE9USEVSV0lTRSwgQVJJU0lORyBGUk9NLApPVVQgT0YgT1IgSU4gQ09OTkVDVElPTiBXSVRIIFRIRSBTT0ZUV0FSRSBPUiBUSEUgVVNFIE9SIE9USEVSIERFQUxJTkdTIElOIFRIRQpTT0ZUV0FSRS4K
```
`.\FileToVariables.exe --file ../../LICENSE_NEW --var-format "dataxyz{i}" read`:
→ We get the MIT license from the environment variables back.## Thanks to:
* [upload-rust-binary-action](https://github.com/taiki-e/upload-rust-binary-action)