api

package
v0.0.0-...-b00d09b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 90 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureGraph

func ConfigureGraph(
	ctx context.Context,
	fakeClients bool,
	watcherMgr *watcher.Manager,
	mgmtWatcherMgr *watcher.Manager,
	pool *pgxpool.Pool,
	k8sClients apik8s.ClusterConfigMap,
	vClient vulnerability.Client,
	tenantName string,
	clusters []string,
	hookdClient hookd.Client,
	bifrostAPIURL string,
	defaultLogDestinations []logging.SupportedLogDestination,
	log logrus.FieldLogger,
) (func(http.Handler) http.Handler, error)

func Run

func Run(ctx context.Context)

Types

type ClusterInfo

type ClusterInfo struct {
	GCP bool
}

type ClusterList

type ClusterList map[string]ClusterInfo

type Config

type Config struct {
	// Tenant is the active tenant
	Tenant string `env:"TENANT,default=dev-nais"`

	// TenantDomain The domain for the tenant.
	TenantDomain string `env:"TENANT_DOMAIN,default=example.com"`

	// GoogleManagementProjectID The ID of the NAIS management project in the tenant organization in GCP.
	GoogleManagementProjectID string `env:"GOOGLE_MANAGEMENT_PROJECT_ID"`

	// DatabaseConnectionString is the database DSN
	DatabaseConnectionString string `env:"DATABASE_URL,default=postgres://api:api@127.0.0.1:3002/api?sslmode=disable"`

	LogFormat string `env:"LOG_FORMAT,default=json"`
	LogLevel  string `env:"LOG_LEVEL,default=info"`

	// StaticServiceAccounts A JSON-encoded value describing a set of service accounts to be created when the
	// application starts. Refer to the README for the format.
	StaticServiceAccounts StaticServiceAccounts `env:"STATIC_SERVICE_ACCOUNTS"`

	// WithFakeKubernetes When set to true, the api will use a fake kubernetes client.
	WithFakeClients bool `env:"WITH_FAKE_CLIENTS"`

	// ListenAddress is host:port combination used by the http server
	ListenAddress         string `env:"LISTEN_ADDRESS,default=127.0.0.1:3000"`
	InternalListenAddress string `env:"INTERNAL_LISTEN_ADDRESS,default=127.0.0.1:3005"`

	// GRPCListenAddress is host:port combination used by the GRPC server
	GRPCListenAddress string `env:"GRPC_LISTEN_ADDRESS,default=127.0.0.1:3001"`

	LeaseName      string `env:"LEASE_NAME,default=nais-api-lease"`
	LeaseNamespace string `env:"LEASE_NAMESPACE,default=nais-system"`

	ReplaceEnvironmentNames map[string]string `env:"REPLACE_ENVIRONMENT_NAMES, noinit"`

	K8s             k8sConfig
	Usersync        usersyncConfig
	Cost            costConfig
	DependencyTrack dependencyTrackConfig
	Hookd           hookdConfig
	OAuth           oAuthConfig
	Unleash         unleashConfig
	Logging         loggingConfig
}

func NewConfig

func NewConfig(ctx context.Context, lookuper envconfig.Lookuper) (*Config, error)

NewConfig creates a new configuration instance from environment variables

type StaticServiceAccount

type StaticServiceAccount struct {
	Name   string                     `json:"name"`
	Roles  []StaticServiceAccountRole `json:"roles"`
	APIKey string                     `json:"apiKey"`
}

type StaticServiceAccountRole

type StaticServiceAccountRole struct {
	Name string `json:"name"`
}

type StaticServiceAccounts

type StaticServiceAccounts []StaticServiceAccount

func (*StaticServiceAccounts) UnmarshalJSON

func (s *StaticServiceAccounts) UnmarshalJSON(value []byte) error

Jump to

Keyboard shortcuts

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