github.com/informationsea/shellflow@v0.1.3/shellflow_environment.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"path"
     6  
     7  	"github.com/informationsea/shellflow/flowscript"
     8  )
     9  
    10  const WorkflowLogDir = "shellflow-wf"
    11  
    12  type Environment struct {
    13  	flowEnvironment flowscript.Environment
    14  	parameters      map[string]interface{}
    15  	workflowRoot    string
    16  	workDir         string
    17  	skipSha         bool
    18  	dryRun          bool
    19  	scriptsOnly     bool
    20  	rerunAll        bool
    21  }
    22  
    23  // NewEnvironment creates new Envrionment value
    24  func NewEnvironment() *Environment {
    25  	wd, err := os.Getwd()
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  	return &Environment{
    30  		flowEnvironment: flowscript.NewGlobalEnvironment(),
    31  		parameters:      make(map[string]interface{}),
    32  		workflowRoot:    path.Join(wd, WorkflowLogDir),
    33  		workDir:         wd,
    34  		skipSha:         false,
    35  		dryRun:          false,
    36  		scriptsOnly:     false,
    37  		rerunAll:        false,
    38  	}
    39  }