mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Fix using TMPDIR from the environment when running from the binary image.
This commit is contained in:
parent
d70ed07b12
commit
516bb28ec0
@ -4,13 +4,6 @@
|
||||
|
||||
(in-package #:pgloader.archive)
|
||||
|
||||
(defparameter *default-tmpdir*
|
||||
(let* ((tmpdir (uiop:getenv "TMPDIR"))
|
||||
(tmpdir (or (and tmpdir (probe-file tmpdir)) "/tmp"))
|
||||
(tmpdir (fad:pathname-as-directory tmpdir)))
|
||||
(fad:pathname-as-directory (merge-pathnames "pgloader" tmpdir)))
|
||||
"Place where to fetch and expand archives on-disk.")
|
||||
|
||||
(defun http-fetch-file (url &key (tmpdir *default-tmpdir*))
|
||||
"Download a file from URL into TMPDIR."
|
||||
|
||||
|
||||
@ -86,10 +86,14 @@
|
||||
(setf *root-dir* (fad:pathname-as-directory root-dir))
|
||||
(mkdir-or-die *root-dir* debug)
|
||||
|
||||
;; Set parameters that come from the environement
|
||||
(init-params-from-environment)
|
||||
|
||||
;; Then process options
|
||||
(when debug
|
||||
(format t "sb-impl::*default-external-format* ~s~%"
|
||||
sb-impl::*default-external-format*))
|
||||
sb-impl::*default-external-format*)
|
||||
(format t "tmpdir: ~s~%" *default-tmpdir*))
|
||||
|
||||
(when version
|
||||
(format t "pgloader version ~s~%" *version-string*))
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
#:*myconn-user*
|
||||
#:*myconn-pass*
|
||||
#:*state*
|
||||
#:*default-tmpdir*
|
||||
#:init-params-from-environment
|
||||
#:getenv-default))
|
||||
|
||||
(in-package :pgloader.params)
|
||||
@ -83,3 +85,26 @@
|
||||
(defparameter *myconn-port* 3306)
|
||||
(defparameter *myconn-user* (uiop:getenv "USER"))
|
||||
(defparameter *myconn-pass* nil)
|
||||
|
||||
;;;
|
||||
;;; Archive processing: downloads and unzip.
|
||||
;;;
|
||||
(defparameter *default-tmpdir*
|
||||
(let* ((tmpdir (uiop:getenv "TMPDIR"))
|
||||
(tmpdir (or (and tmpdir (probe-file tmpdir)) "/tmp"))
|
||||
(tmpdir (fad:pathname-as-directory tmpdir)))
|
||||
(fad:pathname-as-directory (merge-pathnames "pgloader" tmpdir)))
|
||||
"Place where to fetch and expand archives on-disk.")
|
||||
|
||||
;;;
|
||||
;;; Run time initialisation of ENV provided parameters
|
||||
;;;
|
||||
;;; The command parser dynamically inspect the environment when building the
|
||||
;;; connection parameters, so that we don't need to provision for those here.
|
||||
;;;
|
||||
(defun init-params-from-environment ()
|
||||
"Some of our parameters get their default value from the env. Do that at
|
||||
runtime when using a compiled binary."
|
||||
(setf *default-tmpdir*
|
||||
(fad:pathname-as-directory
|
||||
(getenv-default "TMPDIR" *default-tmpdir*))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user