GNU Guileで.envを読み込む

#!/usr/bin/env guile -s !# (use-modules (ice-9 rdelim)) (define (dotenv-apply-from-file filename) (map (lambda (env-val) (apply setenv env-val)) (map (lambda (line) (let ((env-val (string-split line #\=))) `(,(car env-val) ,(car (cdr env-val))))) (call-with-input-file filename (lambda (dotenv-file) (let loop ((ls1 '()) (line (read-line dotenv-file))) (if (eof-object? line) (begin (close-input-port dotenv-file) (reverse ls1)) (loop (cons line ls1) (read-line dotenv-file))))))))) (dotenv-apply-from-file "/ng/symdon/public/.env")...

 · 1 min · しむどん三度無視