github.com/kotalco/kotal@v0.3.0/clients/aptos/aptos_core_client.go (about)

     1  package aptos
     2  
     3  import (
     4  	"fmt"
     5  
     6  	aptosv1alpha1 "github.com/kotalco/kotal/apis/aptos/v1alpha1"
     7  	"github.com/kotalco/kotal/controllers/shared"
     8  	corev1 "k8s.io/api/core/v1"
     9  )
    10  
    11  // AptosCoreClient is Aptos core client
    12  // https://github.com/aptos-labs/aptos-core
    13  type AptosCoreClient struct {
    14  	node *aptosv1alpha1.Node
    15  }
    16  
    17  // Images
    18  const (
    19  	// AptosCoreHomeDir is Aptos Core image home dir
    20  	// TODO: create aptos image with non root user and /home/aptos home directory
    21  	AptosCoreHomeDir = "/opt/aptos"
    22  )
    23  
    24  // Command returns environment variables for the client
    25  func (c *AptosCoreClient) Env() (env []corev1.EnvVar) {
    26  	return
    27  }
    28  
    29  // Command is Aptos Core client entrypoint
    30  func (c *AptosCoreClient) Command() (command []string) {
    31  	command = append(command, "aptos-node")
    32  	return
    33  }
    34  
    35  // Args returns Aptos Core client args
    36  func (c *AptosCoreClient) Args() (args []string) {
    37  	configPath := fmt.Sprintf("%s/config.yaml", shared.PathConfig(c.HomeDir()))
    38  	args = append(args, AptosArgConfig, configPath)
    39  	return
    40  }
    41  
    42  // HomeDir is the home directory of Aptos Core client image
    43  func (c *AptosCoreClient) HomeDir() string {
    44  	return AptosCoreHomeDir
    45  }