yashiro

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 2 Imported by: 0

README

Yashiro

Yashiro is a templating engine with the external stores.

Service

AWS

Usage

See Godoc.

go get github.com/s-dwinter/yashiro

CLI Tool

Install

Download binary from release page.

Example

See example.

Documentation

Overview

Example
package main

import (
	"context"
	"log"
	"os"

	awsconfig "github.com/aws/aws-sdk-go-v2/config"
	"github.com/s-dwinter/yashiro"
	"github.com/s-dwinter/yashiro/pkg/config"
)

func main() {
	ctx := context.TODO()

	sdkConfig, err := awsconfig.LoadDefaultConfig(ctx)
	if err != nil {
		log.Fatalf("failed to load config: %s", err)
	}

	refName := "example"
	cfg := &config.Config{
		Aws: &config.AwsConfig{
			ParameterStoreValues: []config.AwsParameterStoreValueConfig{
				{
					ValueConfig: config.ValueConfig{
						Name:   "/example",
						Ref:    &refName,
						IsJSON: true,
					},
				},
			},
			SdkConfig: &sdkConfig,
		},
	}

	eng, err := yashiro.NewEngine(cfg)
	if err != nil {
		log.Fatalf("failed to crate engine: %s", err)
	}

	text := `This is example code. The message is {{ .example.message }}.`

	if err := eng.Render(ctx, text, os.Stdout); err != nil {
		log.Fatalf("failed to render text: %s", err)
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// NewConfigFromFile returns a new Config from file.
	NewConfigFromFile = config.NewFromFile

	// NewEngine returns a new Engine.
	NewEngine = engine.New
)

Functions

This section is empty.

Types

type Engine

type Engine = engine.Engine

Engine initializes external store client and template.

Directories

Path Synopsis
cmd
ysr
internal
cmd
pkg

Jump to

Keyboard shortcuts

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