Documentation
¶
Index ¶
Constants ¶
const DefaultLocation = "/var/lib/pterodactyl/config.yml"
Variables ¶
var Mutex sync.RWMutex
Functions ¶
func Set ¶
func Set(c *Configuration)
Set the global configuration instance. This is a blocking operation such that anything trying to set a different configuration value, or read the configuration will be paused until it is complete.
func SetDebugViaFlag ¶
func SetDebugViaFlag(d bool)
Types ¶
type ApiConfiguration ¶
type ApiConfiguration struct { // The interface that the internal webserver should bind to. Host string `default:"0.0.0.0" yaml:"host"` // The port that the internal webserver should bind to. Port int `default:"8080" yaml:"port"` // SSL configuration for the daemon. Ssl struct { Enabled bool `default:"false"` CertificateFile string `json:"cert" yaml:"cert"` KeyFile string `json:"key" yaml:"key"` } // The maximum size for files uploaded through the Panel in bytes. UploadLimit int `default:"100" json:"upload_limit" yaml:"upload_limit"` }
Defines the configuration for the internal API that is exposed by the daemon webserver.
type Configuration ¶
type Configuration struct { sync.RWMutex `json:"-" yaml:"-"` // Determines if wings should be running in debug mode. This value is ignored // if the debug flag is passed through the command line arguments. Debug bool // A unique identifier for this node in the Panel. Uuid string // An identifier for the token which must be included in any requests to the panel // so that the token can be looked up correctly. AuthenticationTokenId string `json:"token_id" yaml:"token_id"` // The token used when performing operations. Requests to this instance must // validate against it. AuthenticationToken string `json:"token" yaml:"token"` Api ApiConfiguration System SystemConfiguration Docker DockerConfiguration // The amount of time in seconds that should elapse between disk usage checks // run by the daemon. Setting a higher number can result in better IO performance // at an increased risk of a malicious user creating a process that goes over // the assigned disk limits. DiskCheckTimeout int `yaml:"disk_check_timeout"` // Defines internal throttling configurations for server processes to prevent // someone from running an endless loop that spams data to logs. Throttles struct { // The number of data overage warnings (inclusive) that can accumulate // before a process is terminated. KillAtCount int `default:"5" yaml:"kill_at_count"` // The number of seconds that must elapse before the internal counter // begins decrementing warnings assigned to a process that is outputting // too much data. DecaySeconds int `default:"10" json:"decay" yaml:"decay"` // The total number of bytes allowed to be output by a server process // per interval. BytesPerInterval int `default:"4096" json:"bytes" yaml:"bytes"` // The amount of time that should lapse between data output throttle // checks. This should be defined in milliseconds. CheckInterval int `default:"100" yaml:"check_interval"` } // The location where the panel is running that this daemon should connect to // to collect data and send events. PanelLocation string `json:"remote" yaml:"remote"` // contains filtered or unexported fields }
func Get ¶
func Get() *Configuration
Get the global configuration instance. This is a read-safe operation that will block if the configuration is presently being modified.
func ReadConfiguration ¶
func ReadConfiguration(path string) (*Configuration, error)
Reads the configuration from the provided file and returns the configuration object that can then be used.
func (*Configuration) EnsureFilePermissions ¶
func (c *Configuration) EnsureFilePermissions() error
Ensures that the configured data directory has the correct permissions assigned to all of the files and folders within.
func (*Configuration) EnsurePterodactylUser ¶
func (c *Configuration) EnsurePterodactylUser() (*user.User, error)
Ensures that the Pterodactyl core user exists on the system. This user will be the owner of all data in the root data directory and is used as the user within containers.
If files are not owned by this user there will be issues with permissions on Docker mount points.
func (*Configuration) GetPath ¶
func (c *Configuration) GetPath() string
Returns the path for this configuration file.
func (*Configuration) WriteToDisk ¶
func (c *Configuration) WriteToDisk() error
Writes the configuration to the disk as a blocking operation by obtaining an exclusive lock on the file. This prevents something else from writing at the exact same time and leading to bad data conditions.
type DockerConfiguration ¶
type DockerConfiguration struct { // Network configuration that should be used when creating a new network // for containers run through the daemon. Network DockerNetworkConfiguration `json:"network" yaml:"network"` // If true, container images will be updated when a server starts if there // is an update available. If false the daemon will not attempt updates and will // defer to the host system to manage image updates. UpdateImages bool `default:"true" json:"update_images" yaml:"update_images"` // The location of the Docker socket. Socket string `default:"/var/run/docker.sock"` // Defines the location of the timezone file on the host system that should // be mounted into the created containers so that they all use the same time. TimezonePath string `default:"/etc/timezone" json:"timezone_path" yaml:"timezone_path"` }
Defines the docker configuration used by the daemon when interacting with containers and networks on the system.
type DockerNetworkConfiguration ¶
type DockerNetworkConfiguration struct { // The interface that should be used to create the network. Must not conflict // with any other interfaces in use by Docker or on the system. Interface string `default:"172.18.0.1"` // The DNS settings for containers. Dns []string `default:"[\"1.1.1.1\", \"1.0.0.1\"]"` // The name of the network to use. If this network already exists it will not // be created. If it is not found, a new network will be created using the interface // defined. Name string `default:"pterodactyl_nw"` ISPN bool `default:"false" yaml:"ispn"` Driver string `default:"bridge"` IsInternal bool `default:"false" yaml:"is_internal"` EnableICC bool `default:"true" yaml:"enable_icc"` Interfaces dockerNetworkInterfaces `yaml:"interfaces"` }
type SftpConfiguration ¶
type SftpConfiguration struct { // If set to false, the internal SFTP server will not be booted and you will need // to run the SFTP server independent of this program. UseInternalSystem bool `default:"true" json:"use_internal" yaml:"use_internal"` // If set to true disk checking will not be performed. This will prevent the SFTP // server from checking the total size of a directory when uploading files. DisableDiskChecking bool `default:"false" yaml:"disable_disk_checking"` // The bind address of the SFTP server. Address string `default:"0.0.0.0" json:"bind_address" yaml:"bind_address"` // The bind port of the SFTP server. Port int `default:"2022" json:"bind_port" yaml:"bind_port"` // If set to true, no write actions will be allowed on the SFTP server. ReadOnly bool `default:"false" yaml:"read_only"` }
Defines the configuration of the internal SFTP server.
type SystemConfiguration ¶
type SystemConfiguration struct { // The root directory where all of the pterodactyl data is stored at. RootDirectory string `default:"/var/lib/pterodactyl" yaml:"root_directory"` // Directory where logs for server installations and other wings events are logged. LogDirectory string `default:"/var/log/pterodactyl" yaml:"log_directory"` // Directory where the server data is stored at. Data string `default:"/var/lib/pterodactyl/volumes" yaml:"data"` // Directory where server archives for transferring will be stored. ArchiveDirectory string `default:"/var/lib/pterodactyl/archives" yaml:"archive_directory"` // Directory where local backups will be stored on the machine. BackupDirectory string `default:"/var/lib/pterodactyl/backups" yaml:"backup_directory"` // The user that should own all of the server files, and be used for containers. Username string `default:"pterodactyl" yaml:"username"` // Definitions for the user that gets created to ensure that we can quickly access // this information without constantly having to do a system lookup. User struct { Uid int Gid int } // Determines if permissions for a server should be set automatically on // daemon boot. This can take a long time on systems with many servers, or on // systems with servers containing thousands of files. // // Setting this to true by default helps us avoid a lot of support requests // from people that keep trying to move files around as a root user leading // to server permission issues. // // In production and heavy use environments where boot speed is essential, // this should be set to false as servers will self-correct permissions on // boot anyways. SetPermissionsOnBoot bool `default:"true" yaml:"set_permissions_on_boot"` // Determines if Wings should detect a server that stops with a normal exit code of // "0" as being crashed if the process stopped without any Wings interaction. E.g. // the user did not press the stop button, but the process stopped cleanly. DetectCleanExitAsCrash bool `default:"true" yaml:"detect_clean_exit_as_crash"` Sftp *SftpConfiguration `yaml:"sftp"` }
Defines basic system configuration settings.
func (*SystemConfiguration) ConfigureDirectories ¶
func (sc *SystemConfiguration) ConfigureDirectories() error
Ensures that all of the system directories exist on the system. These directories are created so that only the owner can read the data, and no other users.
func (*SystemConfiguration) GetInstallLogPath ¶
func (sc *SystemConfiguration) GetInstallLogPath() string
Returns the location of the JSON file that tracks server states.
func (*SystemConfiguration) GetStatesPath ¶
func (sc *SystemConfiguration) GetStatesPath() string
Returns the location of the JSON file that tracks server states.