package
0.0.0-20240116224956-e289d49a7aa9
Repository: https://github.com/southclaws/sampctl.git
Documentation: pkg.go.dev
# Functions
CopyFileToRuntime copies a specific file to execute to the specified version's runtime directory.
Ensure will make sure a Config's dir is representative of the held configuration.
EnsureBinaries ensures the dir has all the necessary files to run a server.
EnsurePlugins validates and downloads plugin binary files.
EnsureScripts checks that all the declared scripts are present.
EnsureVersionedPlugin automatically downloads a plugin binary from its github releases page.
EnsureVersionedPluginCached ensures that a plugin exists in the cache.
FindPackage returns a server resource package for the given version or nil if it's invalid.
FromCache tries to grab a server package from cache, `hit` indicates if it was successful.
FromNet downloads a server package to the cache, then calls FromCache to finish the job.
GenerateServerCfg creates a settings file in the SA:MP "server.cfg" format at the specified location nolint:gocyclo.
GetResource searches a list of resources for one that matches the given platform.
GetResourcePath returns a path where a resource should be stored given the metadata.
GetRuntimePath returns the path from the cache directory where the runtime for a specific version of the server should exist.
GetServerPackage checks if a cached package is available and if not, downloads it to dir.
InitialiseServer creates a samp.json by asking the user a series of questions nolint:gocyclo.
LoadEnvironmentVariables loads Config fields from environment variables - the variable names are simply the `json` tag names uppercased and prefixed with `SAMP_` nolint:gocyclo.
MatchesChecksum checks if the file at the given path src is the correct file for the specified runtime package via MD5 sum.
NewConfigFromEnvironment creates a Config from the given environment which includes a directory which is searched for either `samp.json` or `samp.yaml` and environment variable versions of the config parameters.
PluginFromCache tries to grab a plugin asset from the cache, `hit` indicates if it was successful.
PluginFromNet downloads a plugin from the given metadata to the cache directory.
PrepareRuntimeDirectory sets up a directory in ~/.samp that contains the server runtime.
Run handles the actual running of the server process - it collects log output too.
RunContainer does what Run does but inside a Linux container nolint:gocyclo.