config

package
v0.26.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: GPL-3.0 Imports: 12 Imported by: 1

README

コンフィグを取得するためのパッケージ

パッケージ化とテストコードの作成が必要

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureMarmotConfig added in v0.11.3

func EnsureMarmotConfig() error

EnsureMarmotConfig は $HOME/.marmot が存在しない場合、 デフォルト設定を直接書き込んで自動作成する。

func GetClientConfig2 added in v0.8.9

func GetClientConfig2(apiConfigFilename string) (*client.MarmotEndpoint, error)

GetClientConfig2 はコンフィグからエンドポイントを取り出して返す。 apiConfigFilename が指定された場合はそのファイルを $HOME/.marmot 形式として読み込む。 省略時は EnsureMarmotConfig() で $HOME/.marmot を保証してから読み込む。

func MarmotConfigPath added in v0.11.2

func MarmotConfigPath() string

MarmotConfigPath は $HOME/.marmot のパスを返す。 Windows では USERPROFILE を HOME の代わりに使う。

func ReadYamlConfig added in v0.9.1

func ReadYamlConfig(fn string, yamlConfig interface{}) error

YAML形式のコンフィグファイルを構造体に読み込む

func WriteMarmotConfig added in v0.11.2

func WriteMarmotConfig(path string, cfg *MarmotConfig) error

WriteMarmotConfig は MarmotConfig を指定パスに書き込む

Types

type ClientConfig added in v0.8.9

type ClientConfig struct {
	ApiServerUrl string `yaml:"api_server"`
}

type Hypervisors_yaml

type Hypervisors_yaml struct {
	Imgs []Image_yaml `yaml:"image_template"`
	Seq  []SeqNo_yaml `yaml:"seqno"`
}

type Image_yaml

type Image_yaml struct {
	Name           string `yaml:"name"`
	VolumeGroup    string `yaml:"volumegroup"`
	LogicalVolume  string `yaml:"logicalvolume"`
	Qcow2ImagePath string `yaml:"qcow2_path"`
}

OSイメージ テンプレート

type MarmotConfig

type MarmotConfig struct {
	// Current はアクティブなエンドポイントのインデックス (0始まり)
	Current               int      `yaml:"current"`
	Endpoints             []string `yaml:"endpoints"`
	InsecureSkipTLSVerify bool     `yaml:"insecure-skip-tls-verify"`
	EndpointComments      []string `yaml:"endpointComments,omitempty"`
}

MarmotConfig は $HOME/.marmot に保存される複数エンドポイント設定

func ReadMarmotConfig added in v0.11.2

func ReadMarmotConfig(path string) (*MarmotConfig, error)

ReadMarmotConfig は指定パスから MarmotConfig を読み込む

func (*MarmotConfig) ActiveEndpoint added in v0.11.2

func (c *MarmotConfig) ActiveEndpoint() (string, error)

ActiveEndpoint は現在アクティブなエンドポイントURLを返す

func (*MarmotConfig) EndpointComment added in v0.12.0

func (c *MarmotConfig) EndpointComment(index int) string

EndpointComment は指定インデックスのコメントを返す。

func (*MarmotConfig) NormalizeEndpointComments added in v0.12.0

func (c *MarmotConfig) NormalizeEndpointComments()

NormalizeEndpointComments は Endpoints と EndpointComments の要素数を揃える。

type SeqNo_yaml

type SeqNo_yaml struct {
	Start uint64 `yaml:"start"`
	Step  uint64 `yaml:"step"`
	Key   string `yaml:"name"`
}

シーケンス番号

type StgPool_yaml

type StgPool_yaml struct {
	VolGroup string `yaml:"vg"`
	Type     string `yaml:"type"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL