config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config persists per-customer workspace aliases and favourites to a JSON file on disk. Each customer has a list of Environments where an Environment is an alias (e.g. "DEV", "feature") paired with the Fabric workspace display name that alias resolves to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCustomer

func AddCustomer(path string, name string, customer Customer) error

func EditCustomer

func EditCustomer(path string, name string, customer Customer) error

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the platform-appropriate config location.

func RemoveCustomer

func RemoveCustomer(path string, name string) error

func Save

func Save(path string, cfg Config) error

func SetFavorites

func SetFavorites(path string, name string, favorites []NotebookFavorite) error

Types

type Config

type Config struct {
	Customers map[string]Customer `json:"customers"`
}

func Load

func Load(path string) (Config, error)

type Customer

type Customer struct {
	Environments []Environment      `json:"environments"`
	Favorites    []NotebookFavorite `json:"favorites,omitempty"`
}

Customer groups one tenant's environments and notebook favourites. A customer with zero Environments is valid — they just can't run notebooks until they add at least one via `futils edit`.

func (Customer) FavoriteFor

func (c Customer) FavoriteFor(name string) (NotebookFavorite, bool)

FavoriteFor returns the favourite entry for the given notebook name, and a boolean indicating whether it was found.

func (Customer) FavoriteNames

func (c Customer) FavoriteNames() []string

FavoriteNames returns the display names of favourited notebooks in saved order.

func (*Customer) UnmarshalJSON

func (c *Customer) UnmarshalJSON(data []byte) error

UnmarshalJSON transparently migrates three legacy shapes onto the current `environments: [{alias, workspaces: []}]` form:

  1. `workspace_pattern` + `environments: [string]` — earliest shape, a pattern with {env} placeholder substituted per env alias.
  2. `environments: [{alias, workspace_name: string}]` — intermediate shape, single workspace per alias.
  3. `environments: [{alias, workspaces: []string}]` — current shape.

Detection peeks at the first env entry: a quote means string (#1), otherwise it's an object — and we look for `workspace_name` (#2) vs `workspaces` (#3) inside it. On next Save the file is rewritten in the current shape and legacy fields disappear.

func (Customer) Workspaces

func (c Customer) Workspaces(alias string) ([]string, bool)

Workspaces returns the workspace display names mapped to an alias, plus a boolean indicating whether the alias was found. Callers that previously expected a single workspace should now iterate the slice — every flow that resolves items by env is expected to aggregate across all of them.

type Environment

type Environment struct {
	Alias      string   `json:"alias"`
	Workspaces []string `json:"workspaces"`
}

Environment pairs a user-chosen alias (menu label) with one or more Fabric workspaces it resolves to. Multiple workspaces per alias is the common case for real Fabric deployments — e.g. a "DEV" environment often spans both a Config workspace (notebooks) and a SemMod workspace (semantic models). Run / Refresh aggregate items across every workspace under the chosen alias.

type NotebookFavorite

type NotebookFavorite struct {
	Name       string   `json:"name"`
	Parameters []string `json:"parameters,omitempty"`
}

NotebookFavorite pins a single notebook (by displayName) and optionally a subset of its parameters. An empty Parameters slice means "no filter — show all parameters the Papermill cell declares".

Jump to

Keyboard shortcuts

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