github.com/kotalco/kotal@v0.3.0/clients/filecoin/lotus_client.go (about)

     1  package filecoin
     2  
     3  import (
     4  	filecoinv1alpha1 "github.com/kotalco/kotal/apis/filecoin/v1alpha1"
     5  	"github.com/kotalco/kotal/controllers/shared"
     6  	corev1 "k8s.io/api/core/v1"
     7  )
     8  
     9  // LotusClient is lotus filecoin client
    10  // https://github.com/filecoin-project/lotus
    11  type LotusClient struct {
    12  	node *filecoinv1alpha1.Node
    13  }
    14  
    15  // Images
    16  const (
    17  	//  LotusHomeDir is lotus client image home dir
    18  	LotusHomeDir = "/home/fc"
    19  )
    20  
    21  // Command is lotus image command
    22  func (c *LotusClient) Command() (command []string) {
    23  	command = append(command, "lotus", "daemon")
    24  	return
    25  }
    26  
    27  // Command returns environment variables for the client
    28  func (c *LotusClient) Env() []corev1.EnvVar {
    29  	return []corev1.EnvVar{
    30  		{
    31  			Name:  EnvLotusPath,
    32  			Value: shared.PathData(c.HomeDir()),
    33  		},
    34  		{
    35  			Name:  EnvLogLevel,
    36  			Value: string(c.node.Spec.Logging),
    37  		},
    38  	}
    39  }
    40  
    41  // Args returns lotus client args from node spec
    42  func (c *LotusClient) Args() []string {
    43  	return nil
    44  }
    45  
    46  // HomeDir returns lotus image home directory
    47  func (c *LotusClient) HomeDir() string {
    48  	return LotusHomeDir
    49  }