From: Frank Duncan Date: Mon, 27 Dec 2021 18:40:20 +0000 (-0600) Subject: Add environments for running X-Git-Url: https://code.consxy.com/gitweb/?a=commitdiff_plain;h=22bc93248268f84257732f90fd383848ed262ca4;p=candle Add environments for running --- diff --git a/src/main/aws/aws.lisp b/src/main/aws/aws.lisp index c149985..c7fb21d 100644 --- a/src/main/aws/aws.lisp +++ b/src/main/aws/aws.lisp @@ -118,7 +118,7 @@ "-i" *aws-keyfile* (describe-property "PublicIpAddress") - (format nil "cd ~A ; ~A run" *remote-work-dir* *remote-candle-location*)) + (format nil "cd ~A ; ~A run --env aws" *remote-work-dir* *remote-candle-location*)) :output out-str :error out-str :wait t))))) diff --git a/src/main/base.lisp b/src/main/base.lisp index f5995a4..793841a 100644 --- a/src/main/base.lisp +++ b/src/main/base.lisp @@ -16,6 +16,22 @@ DESCRIPTION: The main directory for all candle work to be done in. When the server is running in local mode, this is also the place that builds are built in") +(defvar *environment* :local + "*ENVIRONMENT* + +VALUE TYPE: + + A keyword + +INITIAL VALUE: + + :LOCAL + +DESCRIPTION: + + The environment that candle is currently running. Useful to do switching in tests + or in the .candle file to do extra boot up processing.") + (define-condition candle-error (error) ((reason :initarg :reason :reader candle-error-reason)) (:documentation diff --git a/src/main/cli.lisp b/src/main/cli.lisp index 75ecd40..697fb42 100644 --- a/src/main/cli.lisp +++ b/src/main/cli.lisp @@ -271,8 +271,12 @@ (let ((options '((:name :help :short "h" :long "help" :description "Print this usage.") - (:name :task :long "task" :variable-name "TASK" :takes-argument t :description "Run TASK")))) + (:name :task :long "task" :variable-name "TASK" :takes-argument t :description "Run TASK") + (:name :env :long "env" :variable-name "ENV" :takes-argument t + :description "Runs candle with *candle-environment* set to ENV as a keyword.")))) (standard-cli "candle run" options args :default nil + (when (opera:option-present :env parsed-options) + (setf candle:*environment* (intern (string-upcase (opera:option-argument :env parsed-options)) :keyword))) (cond ((opera:option-present :task parsed-options) (let diff --git a/src/main/package.lisp b/src/main/package.lisp index fe0bc70..90819d0 100644 --- a/src/main/package.lisp +++ b/src/main/package.lisp @@ -3,7 +3,7 @@ #:server #:add-project #:delete-project #:refresh-project #:list-projects #:project-branch-information #:run #:list-tasks #:*candle-dir* #:*job-system* #:*candle-dir* #:failures #:project-job-information #:get-job-log #:retry-job #:job-project #:project-dir #:process-job-in-system - #:shutdown-system + #:shutdown-system #:*environment* #:candle-error #:candle-error-reason) (:documentation "Main candle package.