project

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 30 Imported by: 0

README

Project Package

Features implemented by this package and its subpackages:

Documentation

Index

Constants

View Source
const (
	PROJECTS_KV_PREFIX                           = "/projects"
	DEV_DATABASES_FOLDER_NAME_IN_PROCESS_TEMPDIR = "dev-databases"

	DEFAULT_MAIN_FILENAME = "main" + inoxconsts.INOXLANG_FILE_EXTENSION
	DEFAULT_TUT_FILENAME  = "learn.tut" + inoxconsts.INOXLANG_FILE_EXTENSION

	CREATION_PARAMS_KEY               = "creation-params"
	CREATION_PARAMS_NAME_KEY          = "name"
	CREATION_PARAMS_ADD_TUT_FILE_KEY  = "add-tut-file"
	CREATION_PARAMS_ADD_MAIN_FILE_KEY = "add-main-file"

	APPS_KEY = "applications"

	PROJECT_NAME_REGEX = "^[a-zA-Z][a-zA-Z0-9_-]*$"
)
View Source
const (
	KV_FILENAME = "projects.kv"

	DEV_OS_DIR           = "dev"
	DEV_DATABASES_OS_DIR = "databases"
)

Variables

View Source
var (
	ErrAppAlreadyExists = errors.New("application already exists")
	ErrAppNotFound      = errors.New("application not found")
	ErrAppNotRegistered = errors.New("application is not registered")
)
View Source
var (
	ErrInvalidProjectName   = errors.New("invalid project name")
	ErrNoCloudflareProvider = errors.New("cloudflare provider not present")
)
View Source
var (
	ErrProjectNotFound                = errors.New("project not found")
	ErrProjectPersistenceNotAvailable = errors.New("project persistence is not available")
)
View Source
var (
	CLOUDFLARE_ACCOUNT_ID                  = os.Getenv("CLOUDFLARE_ACCOUNT_ID")
	CLOUDFLARE_ADDITIONAL_TOKENS_API_TOKEN = os.Getenv("CLOUDFLARE_ADDITIONAL_TOKENS_API_TOKEN")
)
View Source
var (
	ErrFailedToListSecrets     = errors.New("failed to list secrets")
	ErrNoSecretStorage         = errors.New("no secret storage")
	ErrSecretStorageAlreadySet = errors.New("secret storage field already set")
)

Functions

func TestUpsertListSecrets

func TestUpsertListSecrets(t *testing.T)

Types

type ApplicationDeploymentPreparationParams

type ApplicationDeploymentPreparationParams struct {
	AppName          string
	UpdateRunningApp bool
}

type CreateProjectParams

type CreateProjectParams struct {
	Name       string `json:"name"`
	Template   string `json:"template,omitempty"`
	AddTutFile bool   `json:"addTutFile,omitempty"`
}

type DevSideProjectConfig

type DevSideProjectConfig struct {
	Cloudflare *cloudflareprovider.DevSideConfig `json:"cloudflare,omitempty"`
}

type Image

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

func (*Image) FilesystemSnapshot

func (img *Image) FilesystemSnapshot() core.FilesystemSnapshot

type OpenProjectParams

type OpenProjectParams struct {
	Id               core.ProjectID
	DevSideConfig    DevSideProjectConfig `json:"config"`
	TempTokens       *TempProjectTokens   `json:"tempTokens,omitempty"`
	ExposeWebServers bool
}

type Project

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

func NewDummyProject

func NewDummyProject(name string, fls core.SnapshotableFilesystem) *Project

NewDummyProject creates a project without any providers or tokens, the returned project should only be used in test.

func NewDummyProjectWithConfig

func NewDummyProjectWithConfig(name string, fls core.SnapshotableFilesystem, config ProjectConfiguration) *Project

NewDummyProjectWithConfig creates a project without any providers or tokens, the returned project should only be used in test.

func (*Project) ApplicationModulePath

func (p *Project) ApplicationModulePath(ctx *core.Context, name string) (core.Path, error)

ApplicationModulePath returns the path of the application module.

func (*Project) ApplicationNames

func (p *Project) ApplicationNames(ctx *core.Context) []node.ApplicationName

ApplicationNames returns registered applications.

func (*Project) ApplicationStatusNames

func (p *Project) ApplicationStatusNames(ctx *core.Context) map[node.ApplicationName]string

func (*Project) ApplicationStatuses

func (p *Project) ApplicationStatuses(ctx *core.Context) map[node.ApplicationName]node.ApplicationStatus

func (*Project) BaseImage

func (p *Project) BaseImage() (core.Image, error)

func (*Project) CanProvideS3Credentials

func (p *Project) CanProvideS3Credentials(s3Provider string) (bool, error)

func (*Project) Configuration

func (p *Project) Configuration() core.ProjectConfiguration

func (*Project) CreationParams

func (p *Project) CreationParams() CreateProjectParams

func (*Project) DeleteSecret

func (p *Project) DeleteSecret(ctx *core.Context, name string) error

func (*Project) DeleteSecretsBucket

func (p *Project) DeleteSecretsBucket(ctx *core.Context) error

func (*Project) DevDatabasesDirOnOsFs

func (p *Project) DevDatabasesDirOnOsFs() string

func (*Project) Equal

func (p *Project) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Project) GetS3CredentialsForBucket

func (p *Project) GetS3CredentialsForBucket(
	ctx *core.Context,
	bucketName string,
	provider string,
) (accessKey, secretKey string, s3Endpoint core.Host, _ error)

func (*Project) GetSecrets

func (p *Project) GetSecrets(ctx *core.Context) (secrets []core.ProjectSecret, _ error)

func (*Project) HasProviders

func (p *Project) HasProviders() bool

func (*Project) Id

func (p *Project) Id() core.ProjectID

func (*Project) IsApplicationRegistered

func (p *Project) IsApplicationRegistered(ctx *core.Context, name string) bool

func (*Project) IsMutable

func (p *Project) IsMutable() bool

func (*Project) IsSharable

func (p *Project) IsSharable(originState *core.GlobalState) (bool, string)

func (*Project) IsShared

func (p *Project) IsShared() bool

func (*Project) ListSecrets

func (p *Project) ListSecrets(ctx *core.Context) (info []core.ProjectSecretInfo, _ error)

func (*Project) LiveFilesystem

func (p *Project) LiveFilesystem() core.SnapshotableFilesystem

func (*Project) PrepareApplicationDeployment

func (p *Project) PrepareApplicationDeployment(ctx *core.Context, args ApplicationDeploymentPreparationParams) (node.ApplicationDeployment, error)

func (*Project) PrettyPrint

func (p *Project) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*Project) RegisterApplication

func (p *Project) RegisterApplication(ctx *core.Context, name string, modulePath string) error

func (*Project) Share

func (p *Project) Share(originState *core.GlobalState)

func (*Project) SmartLock

func (p *Project) SmartLock(state *core.GlobalState)

func (*Project) SmartUnlock

func (p *Project) SmartUnlock(state *core.GlobalState)

func (*Project) StopApplication

func (p *Project) StopApplication(ctx *core.Context, args StopApplicationParams) error

func (*Project) TempProjectTokens

func (p *Project) TempProjectTokens(ctx *core.Context) (tokens TempProjectTokens, _ error)

func (*Project) TempProjectTokensNoLock

func (p *Project) TempProjectTokensNoLock(ctx *core.Context) (TempProjectTokens, error)

func (*Project) ToSymbolicValue

func (p *Project) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

func (*Project) UpsertSecret

func (p *Project) UpsertSecret(ctx *core.Context, name, value string) error

type ProjectConfiguration

type ProjectConfiguration struct {
	ExposeWebServers bool
}

func (ProjectConfiguration) AreExposedWebServersAllowed

func (c ProjectConfiguration) AreExposedWebServersAllowed() bool

type Registry

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

func OpenRegistry

func OpenRegistry(projectsDir string, openProjectsContext *core.Context) (*Registry, error)

OpenRegistry opens a project registry located on the OS filesystem.

func (*Registry) Close

func (r *Registry) Close(ctx *core.Context)

func (*Registry) CreateProject

func (r *Registry) CreateProject(ctx *core.Context, params CreateProjectParams) (core.ProjectID, error)

CreateProject

func (*Registry) OpenProject

func (r *Registry) OpenProject(ctx *core.Context, params OpenProjectParams) (*Project, error)

type StopApplicationParams

type StopApplicationParams struct {
	AppName string
}

type TempProjectTokens

type TempProjectTokens struct {
	Cloudflare *cloudflareprovider.HighPermsCloudflareTokens `json:"cloudflare,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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