github.com/kotalco/kotal@v0.3.0/clients/stacks/stacks_node_client.go (about)

     1  package stacks
     2  
     3  import (
     4  	"fmt"
     5  
     6  	stacksv1alpha1 "github.com/kotalco/kotal/apis/stacks/v1alpha1"
     7  	"github.com/kotalco/kotal/controllers/shared"
     8  	corev1 "k8s.io/api/core/v1"
     9  )
    10  
    11  // StacksNodeClient is Stacks blockchain node client
    12  // https://github.com/stacks-network/stacks-blockchain
    13  type StacksNodeClient struct {
    14  	node *stacksv1alpha1.Node
    15  }
    16  
    17  // Images
    18  const (
    19  	// StacksNodeHomeDir is Stacks node image home dir
    20  	// TODO: update home dir after creating a new docker image
    21  	StacksNodeHomeDir = "/home/stacks"
    22  )
    23  
    24  // Command returns environment variables for the client
    25  func (c *StacksNodeClient) Env() (env []corev1.EnvVar) {
    26  	return
    27  }
    28  
    29  // Command is Stacks node client entrypoint
    30  func (c *StacksNodeClient) Command() (command []string) {
    31  
    32  	command = append(command, StacksNodeCommand, StacksStartCommand)
    33  
    34  	return
    35  }
    36  
    37  // Args returns Stacks node client args
    38  func (c *StacksNodeClient) Args() (args []string) {
    39  	_ = c.node
    40  
    41  	args = append(args, StacksArgConfig, fmt.Sprintf("%s/config.toml", shared.PathConfig(c.HomeDir())))
    42  
    43  	return
    44  }
    45  
    46  // HomeDir is the home directory of Stacks node client image
    47  func (c *StacksNodeClient) HomeDir() string {
    48  	return StacksNodeHomeDir
    49  }