mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-09-16 15:52:06 -04:00
- Update Rust to v1.98.1 which resolves a build issues with strange outcomes - Adjusted the DockerSettings and render_template to extract the `rust_version` from the `rust-toolchain.toml` file. This should prevent mismatches and forgetting to update DockerSettings. - Updated typos in GHA and Pre-Commit - Updated all possible crates including hickory which has several CVE's fixed. Signed-off-by: BlackDex <black.dex@gmail.com>
37 lines
1.3 KiB
Python
Executable file
37 lines
1.3 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import argparse
|
|
import json
|
|
import tomllib
|
|
import yaml
|
|
import jinja2
|
|
|
|
# Load settings file
|
|
with open('DockerSettings.yaml', 'r', encoding='utf-8') as yaml_file:
|
|
yaml_data = yaml.safe_load(yaml_file)
|
|
|
|
# Extract the rust_version from the rust-toolchain.toml file
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
with open(os.path.join(script_dir, '..', 'rust-toolchain.toml'), 'rb') as toolchain_file:
|
|
yaml_data["rust_version"] = tomllib.load(toolchain_file)["toolchain"]["channel"]
|
|
|
|
settings_env = jinja2.Environment(
|
|
loader=jinja2.FileSystemLoader(os.getcwd()),
|
|
)
|
|
settings_yaml = yaml.safe_load(settings_env.get_template('DockerSettings.yaml').render(yaml_data))
|
|
|
|
args_parser = argparse.ArgumentParser()
|
|
args_parser.add_argument('template_file', help='Jinja2 template file to render.')
|
|
args_parser.add_argument('render_vars', help='JSON-encoded data to pass to the templating engine.')
|
|
cli_args = args_parser.parse_args()
|
|
|
|
# Merge the default config yaml with the json arguments given.
|
|
render_vars = json.loads(cli_args.render_vars)
|
|
settings_yaml.update(render_vars)
|
|
|
|
environment = jinja2.Environment(
|
|
loader=jinja2.FileSystemLoader(os.getcwd()),
|
|
trim_blocks=True,
|
|
)
|
|
print(environment.get_template(cli_args.template_file).render(settings_yaml))
|