importer

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package importer migrates an existing OpenClaw configuration into memcode's gateway config. OpenClaw is the large incumbent multi-channel gateway; letting a user bring their channels over with one command is how you win a switch without making them reconfigure everything. It reads OpenClaw's plain-JSON openclaw.json (parsed with encoding/json, the same way OpenClaw and Hermes read it), maps each supported channel's credentials to memcode's .env keys and its allow-list to our channels.<name>.allow_from, and reports (never silently drops) anything it can't carry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEnv

func ParseEnv(data []byte) map[string]string

ParseEnv reads a .env file's KEY=VALUE lines into a map, ignoring blanks, comments, and an optional "export " prefix. Used to lift tokens out of a Hermes ~/.hermes/.env for import.

func ProviderKeys

func ProviderKeys(env map[string]string) map[string]string

ProviderKeys returns the subset of env holding a recognized provider API key with a non-empty value — what a migration should copy into memcode's global .env so the agent keeps talking to the same models. Channel bot tokens are NOT here; those come from the channel importer.

Types

type Result

type Result struct {
	Settings gwconfig.Settings
	Secrets  map[string]string
	Notes    []string
}

Result is what an import produced: the non-secret settings to merge into gateway.yaml, the secrets to write to the global .env, and human-readable notes about anything that couldn't be carried automatically.

func FromHermes

func FromHermes(configYAML []byte, env map[string]string) (Result, error)

FromHermes maps a Hermes config.yaml plus its .env (parsed to env) into memcode's gateway config. Hermes and memcode share the same credential variable names, so tokens carry over directly; allowed_users becomes channels.<name>.allow_from.

func FromOpenClaw

func FromOpenClaw(data []byte, getenv func(string) string) (Result, error)

FromOpenClaw parses an OpenClaw config and maps it to memcode's gateway config. getenv resolves env-backed secret references (OpenClaw stores a reference, not the value); pass os.Getenv in production.

Jump to

Keyboard shortcuts

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