config: prevent programmatic updates to specific fields

This commit is contained in:
Matthew Penner 2024-04-10 15:23:03 -06:00
parent 617fbcbf27
commit 5415f8ae07
No known key found for this signature in database

View File

@ -89,7 +89,7 @@ type ApiConfiguration struct {
// Determines if functionality for allowing remote download of files into server directories // Determines if functionality for allowing remote download of files into server directories
// is enabled on this instance. If set to "true" remote downloads will not be possible for // is enabled on this instance. If set to "true" remote downloads will not be possible for
// servers. // servers.
DisableRemoteDownload bool `json:"disable_remote_download" yaml:"disable_remote_download"` DisableRemoteDownload bool `json:"-" yaml:"disable_remote_download"`
// The maximum size for files uploaded through the Panel in MB. // The maximum size for files uploaded through the Panel in MB.
UploadLimit int64 `default:"100" json:"upload_limit" yaml:"upload_limit"` UploadLimit int64 `default:"100" json:"upload_limit" yaml:"upload_limit"`
@ -123,23 +123,23 @@ type RemoteQueryConfiguration struct {
// SystemConfiguration defines basic system configuration settings. // SystemConfiguration defines basic system configuration settings.
type SystemConfiguration struct { type SystemConfiguration struct {
// The root directory where all of the pterodactyl data is stored at. // The root directory where all of the pterodactyl data is stored at.
RootDirectory string `default:"/var/lib/pterodactyl" yaml:"root_directory"` RootDirectory string `default:"/var/lib/pterodactyl" json:"-" yaml:"root_directory"`
// Directory where logs for server installations and other wings events are logged. // Directory where logs for server installations and other wings events are logged.
LogDirectory string `default:"/var/log/pterodactyl" yaml:"log_directory"` LogDirectory string `default:"/var/log/pterodactyl" json:"-" yaml:"log_directory"`
// Directory where the server data is stored at. // Directory where the server data is stored at.
Data string `default:"/var/lib/pterodactyl/volumes" yaml:"data"` Data string `default:"/var/lib/pterodactyl/volumes" json:"-" yaml:"data"`
// Directory where server archives for transferring will be stored. // Directory where server archives for transferring will be stored.
ArchiveDirectory string `default:"/var/lib/pterodactyl/archives" yaml:"archive_directory"` ArchiveDirectory string `default:"/var/lib/pterodactyl/archives" json:"-" yaml:"archive_directory"`
// Directory where local backups will be stored on the machine. // Directory where local backups will be stored on the machine.
BackupDirectory string `default:"/var/lib/pterodactyl/backups" yaml:"backup_directory"` BackupDirectory string `default:"/var/lib/pterodactyl/backups" json:"-" yaml:"backup_directory"`
// TmpDirectory specifies where temporary files for Pterodactyl installation processes // TmpDirectory specifies where temporary files for Pterodactyl installation processes
// should be created. This supports environments running docker-in-docker. // should be created. This supports environments running docker-in-docker.
TmpDirectory string `default:"/tmp/pterodactyl" yaml:"tmp_directory"` TmpDirectory string `default:"/tmp/pterodactyl" json:"-" yaml:"tmp_directory"`
// The user that should own all of the server files, and be used for containers. // The user that should own all of the server files, and be used for containers.
Username string `default:"pterodactyl" yaml:"username"` Username string `default:"pterodactyl" yaml:"username"`
@ -306,7 +306,7 @@ type Configuration struct {
// The location where the panel is running that this daemon should connect to // The location where the panel is running that this daemon should connect to
// to collect data and send events. // to collect data and send events.
PanelLocation string `json:"remote" yaml:"remote"` PanelLocation string `json:"-" yaml:"remote"`
RemoteQuery RemoteQueryConfiguration `json:"remote_query" yaml:"remote_query"` RemoteQuery RemoteQueryConfiguration `json:"remote_query" yaml:"remote_query"`
// AllowedMounts is a list of allowed host-system mount points. // AllowedMounts is a list of allowed host-system mount points.
@ -676,8 +676,10 @@ func getSystemName() (string, error) {
return release["ID"], nil return release["ID"], nil
} }
var openat2 atomic.Bool var (
var openat2Set atomic.Bool openat2 atomic.Bool
openat2Set atomic.Bool
)
func UseOpenat2() bool { func UseOpenat2() bool {
if openat2Set.Load() { if openat2Set.Load() {