Crates.io | ship |
lib.rs | ship |
version | 0.3.1 |
created_at | 2024-11-18 04:21:33.737597+00 |
updated_at | 2024-11-18 04:21:33.737597+00 |
description | Sail your configuration files |
homepage | |
repository | https://github.com/themackabu/ship |
max_upload_size | |
id | 1451764 |
size | 164,579 |
Ship is a powerful configuration service that sails your HCL configurations to different formats (JSON, YAML, TOML) while providing a rich fleet of built-in functions for data transformation.
Built-in Functions
upper
, lower
, trim
, trimspace
, trimprefix
, trimsuffix
abs
, ceil
, floor
, max
, min
, sum
, parseint
join
, split
, range
, merge
, length
, unique
, compact
, flatten
base64encode/decode
, urlencode/decode
md5_hash
, sha1_hash
, sha256_hash
, sha512_hash
uuid_gen
, uuidv5
timestamp
, timeadd
, parseduration
, formatdate
cidrnetmask
, cidrrange
, cidrhost
, cidrsubnets
http_get
, http_post
, http_json
, http_put
file
, filemd5
, filesha1
, filesha256
, filesha512
vault_kv
for HashiCorp Vault key-value store integrationThe service is configured via a config.hcl
file with the following structure:
settings {
listen = "<address:port>" # Service listen address
storage = "<path>" # Storage path for HCL files
vault { # Optional Vault configuration
url = "<vault-url>"
token = "<vault-token>"
}
}
[!CAUTION]
Security Notes
- The service should be configured with appropriate access controls
- Vault token should be kept secure
- Consider network security when exposing HTTP endpoints
- File operations are restricted to the configured storage path
GET /<path>?lang=<format>
Parameters:
path
: Path to the HCL file relative to the storage directorylang
: Target format (json
, yaml
, yml
, or toml
)The service will:
The service supports several special HCL blocks:
locals
: For defining local variableslet/var/vars
: For variable definitionsconst
: For constant values that cannot be overriddenmeta
: For metadata about the configurationThe service provides detailed error messages in the format:
(message)
<error description>
(error)
<status code>
To build and run the service:
cargo build
to compileconfig.hcl
filecargo run
to start the service