Compare commits

...

4 commits

Author SHA1 Message Date
6d36a7f78a ci: switch to alpine for static linking
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2023-11-18 23:23:39 +01:00
87bcce48dd ci: bump crystal version
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2023-11-18 20:19:51 +01:00
4d5d9e3d09 ci: add missing dependencies
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2023-11-18 20:03:57 +01:00
1969ab8a0f fix: add templating support in configuration
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
Refs: #15
2023-11-18 19:56:03 +01:00
4 changed files with 21 additions and 4 deletions

View file

@ -5,7 +5,7 @@ name: default
steps:
- name: build:binary
image: crystallang/crystal:1.7.3
image: crystallang/crystal:1.10.1-alpine
environment:
PACKAGE_BASENAME: mfm_linux_amd64
volumes:
@ -13,11 +13,16 @@ steps:
path: /_cache
commands:
- pwd
- apt-get update &&
apt-get install -y cmake g++ libevent-dev libpcre3-dev libyaml-dev
# - |
# apt-get update && \
# apt-get install -y \
# cmake g++ \
# libevent-dev libpcre3-dev \
# libyaml-dev liblzma-dev
- shards install
- shards build --production --static
- strip bin/mfm
- ./bin/mfm --version
- mkdir -p /_cache/bin
- cp -r bin/mfm /_cache/bin/$PACKAGE_BASENAME

View file

@ -1,5 +1,9 @@
version: 2.0
shards:
crinja:
git: https://github.com/straight-shoota/crinja.git
version: 0.8.1
shellwords:
git: https://github.com/sztheory/shellwords-crystal.git
version: 0.1.0

View file

@ -18,6 +18,8 @@ targets:
# Short description of gx-vault
dependencies:
crinja:
github: straight-shoota/crinja
shellwords:
github: szTheory/shellwords-crystal

View file

@ -3,6 +3,8 @@
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
require "crinja"
require "./filesystems"
module GX
@ -52,7 +54,11 @@ module GX
end
private def load_filesystems(config_path : String)
yaml_data = YAML.parse(File.read(config_path))
file_data = File.read(config_path)
# FIXME: render template on a value basis (instead of global)
file_patched = Crinja.render(file_data, {"env" => ENV.to_h})
yaml_data = YAML.parse(file_patched)
vaults_data = yaml_data["filesystems"].as_a
vaults_data.each do |filesystem_data|