Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AgentCmd = &cobra.Command{ Use: "agent", Short: "Start the agent process", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { if log.GetLevel() < log.InfoLevel { log.SetLevel(log.InfoLevel) } agentMode := config.ModeProject if hostModeFlag { agentMode = config.ModeHost } c, err := config.GetConfig(agentMode) if err != nil { log.Fatal(err) } c.ProjectDir = filepath.Join(os.Getenv("HOME"), c.ProjectName) gitLogWriter := io.MultiWriter(os.Stdout) var agentLogWriter io.Writer if c.LogFilePath != nil { logFile, err := os.OpenFile(*c.LogFilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { log.Fatal(err) } defer logFile.Close() gitLogWriter = io.MultiWriter(os.Stdout, logFile) agentLogWriter = logFile } git := &git.Service{ ProjectDir: c.ProjectDir, GitConfigFileName: filepath.Join(os.Getenv("HOME"), ".gitconfig"), LogWriter: gitLogWriter, } sshServer := &ssh.Server{ ProjectDir: c.ProjectDir, DefaultProjectDir: os.Getenv("HOME"), } tailscaleHostname := workspace.GetProjectHostname(c.WorkspaceId, c.ProjectName) if hostModeFlag { tailscaleHostname = c.WorkspaceId } tailscaleServer := &tailscale.Server{ Hostname: tailscaleHostname, Server: c.Server, } agent := agent.Agent{ Config: c, Git: git, Ssh: sshServer, Tailscale: tailscaleServer, LogWriter: agentLogWriter, } err = agent.Start() if err != nil { log.Fatal(err) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.