jbergstroem / mariadb-alpine

A tiny and fast MariaDB container
MIT License
71 stars 19 forks source link

Rewrite parsing config ini in awk or even shell for readability #190

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/jbergstroem/mariadb-alpine/blob/97eb7c53f9f13d0cc305932ababb90fd4ec0a207/sh/my_print_defaults.sh#L6


# shellcheck shell=dash
set -euo pipefail

# Stack overflow'ed
# TODO Rewrite parsing config ini in awk or even shell for readability
sed -n \
  '/^[ \t]*\[mariadb\]/,/\[/s/^[ \t]*\([^#; \t][^ \t=]*\).*=[ \t]*\(.*\)/--\1=\2/p' \
  /etc/my.cnf.d/* | sed 's:#.*$::g'