file

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 8 Imported by: 0

README

key/file

本地文件实现由 key.NewKey 内部使用,业务不需要直接初始化该子包。

key.yaml 未配置,或 type 为空/未知时,默认读取 ${conf}/root.key。文件内容可以是原始 32 字节, 也可以是 Base64 编码的根密钥;生产环境请将文件权限限制为 04000600

Provider 初始化时会使用系统随机源创建缺失的根密钥文件并设置 0600 权限;已有文件直接复用,不会覆盖。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(cfg *configv1.Key) (internal.Provider, error)

NewFromConfig 根据 Key 配置创建本地文件密钥 Provider。

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider 从本地文件读取密钥,适用于开发环境或挂载的 Kubernetes Secret。

func New

func New(path string) (*Provider, error)

New 创建固定文件路径的密钥 Provider。

func (*Provider) Get

func (p *Provider) Get(_ context.Context, name string) (internal.Secret, error)

Get 读取密钥文件内容。

Jump to

Keyboard shortcuts

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