Documentation ¶
Overview ¶
Package contains all database models
Index ¶
Constants ¶
const ( // Content Security Policy used by the internal server ContentSecurityPolicyNothing = "base-uri 'self'; default-src 'none';" // Content Security policy used by the distillery admin server ContentSecurityPolicyDistilery = "" /* 137-byte string literal not displayed */ )
const DefaultPHPVersion = "8.1"
DefaultPHPVersion is the default php version
const ExportTable = "snapshot"
ExportTable is the name of the table the Export model is stored in. NOTE(twiesing): It is called snapshot for legacy reasons
const GrantTable = "grant"
GrantTable is the name of the table the 'Grant' model is stored in.
const InstanceTable = "distillery"
InstanceTable is the name of the table the 'Instance' model is stored in.
const KeysTable = "keys"
KeysTable is the name of the table the Keys model is stored in.
const LockTable = "locks"
LockTable is the name of the table the 'Metadatum' model is stored in.
const MetadataTable = "metadatum"
MetadataTable is the name of the table the 'Metadatum' model is stored in.
const TokensTable = "tokens"
TokensTable is the name of the table the 'Token' model is stored in.
const UserTable = "users"
UserTable is the name of the table the [`User`] model is stored in.
Variables ¶
This section is empty.
Functions ¶
func ContentSecurityPolicyExamples ¶
func ContentSecurityPolicyExamples() []string
func KnownPHPVersions ¶
func KnownPHPVersions() []string
KnownPHPVersions returns a slice of php versions.
Types ¶
type Export ¶
type Export struct { Pk uint `gorm:"column:pk;primaryKey"` Slug string `gorm:"column:slug"` // slug of instance Created time.Time `gorm:"column:created"` // time the backup was created Path string `gorm:"column:path;not null"` // path the export is stored at Packed bool `gorm:"column:packed;not null"` // was the export packed, or was it staging only? }
Export represents an entry in the export log
type Grant ¶
type Grant struct { Pk uint `gorm:"column:pk;primaryKey"` User string `gorm:"column:user;not null;index:user_slug,unique"` // (distillery) username Slug string `gorm:"column:slug;not null;index:user_slug;index:drupal_slug"` // (distillery) instance slug DrupalUsername string `gorm:"column:drupal_user;not null;index:drupal_slug,unique"` // drupal username DrupalAdminRole bool `gorm:"column:admin;not null"` // drupal admin rights }
Grant represents an access grant to a specific user
type Instance ¶
type Instance struct { // Primary key for the instance Pk uint `gorm:"column:pk;primaryKey"` // time the instance was created Created time.Time `gorm:"column:created;autoCreateTime"` // slug of the system Slug string `gorm:"column:slug;not null;unique"` // email address of the system owner (if any) OwnerEmail string `gorm:"column:owner_email;type:varchar(320)"` // should we automatically enable updates for the system? AutoBlindUpdateEnabled SQLBit1 `gorm:"column:auto_blind_update_enabled;default:1"` // The filesystem path the system can be found under FilesystemBase string `gorm:"column:filesystem_base;not null"` // information about the system being used System `gorm:"embed"` // SQL Database credentials for the system SqlDatabase string `gorm:"column:sql_database;not null"` SqlUsername string `gorm:"column:sql_user;not null"` SqlPassword string `gorm:"column:sql_password;not null"` // GraphDB Repository GraphDBRepository string `gorm:"column:graphdb_repository;not null"` GraphDBUsername string `gorm:"column:graphdb_user;not null"` GraphDBPassword string `gorm:"column:graphdb_password;not null"` }
Instance is a WissKI Instance stored inside the sql database.
It does not represent a running instance; it does not perform any validation.
func (Instance) IsBlindUpdateEnabled ¶
type Keys ¶
type Keys struct { Pk uint `gorm:"column:pk;primaryKey"` User string `gorm:"column:user;not null"` // username of the ssh key Signature []byte `gorm:"column:signature;not null"` // signature of the ssh key Comment string `gorm:"column:comment"` }
Keys represents a distillery ssh key
func (*Keys) PublicKey ¶
PublicKey returns the public key corresponding to this keys. If the key cannot be parsed, returns nil.
func (*Keys) SetPublicKey ¶
SetPublicKey stores a specific public key in this key
func (*Keys) SignatureString ¶
type Lock ¶
type Lock struct { Pk uint `gorm:"column:pk;primaryKey"` Slug string `gorm:"column:slug;not null"` // slug of instance }
Lock represents a log on WissKI Instances
type Metadatum ¶
type Metadatum struct { Pk uint `gorm:"column:pk;primaryKey"` Key string `gorm:"column:key;not null"` // key for the value, see the keys below Slug string `gorm:"column:slug"` // optional slug of instance Value []byte `gorm:"column:value"` // serialized json value of the data }
Metadatum represents a metadatum for a single model
type System ¶
type System struct { // NOTE(twiesing): Any changes here should be reflected in instance_{provision,rebuild}.html and remote/api.ts. PHP string `gorm:"column:php;not null"` // php version to use OpCacheDevelopment bool `gorm:"column:opcache_devel;not null"` // opcache development ContentSecurityPolicy string `gorm:"column:csp;not null"` // content security policy for the system }
System represents system information. It is embedded into the instances struct by gorm.
func (System) GetDockerBaseImage ¶
GetDockerBaseImage returns the docker base image used by the given system.
func (System) OpCacheMode ¶
OpCacheMode returns the name of the `opcache-*.ini` configuration being included in the docker image
type Token ¶
type Token struct { Pk uint `gorm:"column:pk;primaryKey"` Token string `json:"-" gorm:"column:token;unique:true;not null"` // token used by the actual api (shown only once) TokenID string `gorm:"column:id;unique:true;not null"` // token id (displayed to user, used for finding it) User string `gorm:"column:user;not null"` // (distillery) username Description string `gorm:"column:description"` AllScopes bool `gorm:"column:all;not null"` Scopes []byte `gorm:"column:scopes;not null"` // comma-seperated list of scopes }
Token represents an access token for a specific user
type User ¶
type User struct { Pk uint `gorm:"column:pk;primaryKey"` User string `gorm:"column:user;not null;unique"` // name of the user PasswordHash []byte `gorm:"column:password" json:"-"` // password of the user, hashed TOTPEnabled *bool `gorm:"column:totpenabled" json:"-"` // is totp enabled for the user TOTPURL string `gorm:"column:totp" json:"-"` // the totp of the user Enabled *bool `gorm:"enabled;not null" json:"enabled"` Admin *bool `gorm:"column:admin;not null" json:"admin"` }
User represents a distillery user