registry

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package registry is the CLI's list of Norcube services, read from the embedded services.yaml. Endpoints, audiences, `nrc api` service names and code generation all come from here, so adding a service is one manifest entry plus its commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys() []string

Keys returns every service key in manifest order.

Types

type Service

type Service struct {
	// Key names the service in config files, --endpoint-url and
	// NORCUBE_<KEY>_URL. Stable: changing it breaks users' configs.
	Key string `yaml:"key"`
	// Name is the product name shown to people.
	Name string `yaml:"name"`
	// Command is the CLI command group and the service name `nrc api`
	// accepts. Empty for services without commands (the web app).
	Command string `yaml:"command"`
	// Aliases are further names `nrc api` and the command group accept.
	Aliases []string `yaml:"aliases"`
	// Audience is the OAuth audience of the service's access tokens.
	// Empty when the CLI never calls the service with a token.
	Audience string `yaml:"audience"`
	// Endpoint is the production base URL.
	Endpoint string `yaml:"endpoint"`
	// Spec locates the service's Swagger 2.0 file in the backend
	// monorepo: apps/<app>/docs/<file>.
	Spec *Spec `yaml:"spec"`
	// Package is the generated client under internal/api/<package>;
	// empty when no client is generated yet.
	Package string `yaml:"package"`
}

Service is one entry of services.yaml.

func All

func All() []Service

All returns the services in manifest order. The manifest is embedded and validated by tests, so an error here means a broken build; All panics instead of making every caller handle it.

func Callable

func Callable() []Service

Callable returns the services `nrc api` can call: those with an audience and a command name, sorted by command.

func Get

func Get(key string) (Service, bool)

Get returns the service with this key.

func Lookup

func Lookup(name string) (Service, bool)

Lookup finds a service by any of its names (command, alias or key), ignoring case.

func Parse

func Parse(data []byte) ([]Service, error)

Parse reads and validates a manifest.

func (Service) Names

func (s Service) Names() []string

Names returns every name the service answers to in `nrc api`: its command, its aliases and its key.

type Spec

type Spec struct {
	App  string `yaml:"app"`
	File string `yaml:"file"`
}

Spec is where a service's API description lives in the backend monorepo.

func (Spec) Path

func (s Spec) Path() string

Path is the spec's path relative to the backend monorepo root.

Jump to

Keyboard shortcuts

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