Skip to content

Commit

Permalink
config: prevent programmatic updates to specific fields
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpi committed Apr 10, 2024
1 parent 617fbcb commit 5415f8a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type ApiConfiguration struct {
// 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
// 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.
UploadLimit int64 `default:"100" json:"upload_limit" yaml:"upload_limit"`
Expand Down Expand Up @@ -123,23 +123,23 @@ type RemoteQueryConfiguration struct {
// SystemConfiguration defines basic system configuration settings.
type SystemConfiguration struct {
// 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.
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.
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.
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.
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
// 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.
Username string `default:"pterodactyl" yaml:"username"`
Expand Down Expand Up @@ -306,7 +306,7 @@ type Configuration struct {

// 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"`
PanelLocation string `json:"-" yaml:"remote"`
RemoteQuery RemoteQueryConfiguration `json:"remote_query" yaml:"remote_query"`

// AllowedMounts is a list of allowed host-system mount points.
Expand Down Expand Up @@ -676,8 +676,10 @@ func getSystemName() (string, error) {
return release["ID"], nil
}

var openat2 atomic.Bool
var openat2Set atomic.Bool
var (
openat2 atomic.Bool
openat2Set atomic.Bool
)

func UseOpenat2() bool {
if openat2Set.Load() {
Expand Down

0 comments on commit 5415f8a

Please # to comment.