config

package
v0.0.0-...-8d67b62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FULL    = 1
	LITE    = 2
	DNSONLY = 3
	TRIAL   = 4
)

Types of Licenses available, defaults to DNSONLY if a valid license is not recieved from the api

Variables

This section is empty.

Functions

func GetOutboundIP

func GetOutboundIP() string

GetOutboundIP gets the public ip

Types

type Configuration

type Configuration struct {
	// Determines if CosmicPanel should be running in debug mode. This value is ignored
	// if the debug flag is passed through command line arguments
	Debug bool

	System  *SystemConfiguration
	Panel   *PanelConfiguration
	License *LicenseConfiguration
}

Configuration defines the configuration for CosmicPanel

func ReadConfiguration

func ReadConfiguration(path string) (*Configuration, error)

ReadConfiguration reads the configuration from the provided file and returns the confgiuration object that can then be used

func (*Configuration) CheckLicense

func (c *Configuration) CheckLicense(dnsonly bool)

CheckLicense checks against the licesence validation server at https://licenses.cosmicpanel.net

func (*Configuration) EnsureUser

func (c *Configuration) EnsureUser() (*user.User, error)

EnsureUser ensures that the CosmicPanel core user exists on the system. This user will be the owner of all data in the root data directory and is used within containers

If files are not owned by this user, there will be issues with permissions on Docker mount points.

func (*Configuration) RequestDNSONLYLicense

func (c *Configuration) RequestDNSONLYLicense()

RequestDNSONLYLicense requests a dns only license

func (*Configuration) RequestNewLicense

func (c *Configuration) RequestNewLicense(dnsonly bool)

RequestNewLicense requests a new License for dnsonly or for trial

func (*Configuration) RequestTrialLicense

func (c *Configuration) RequestTrialLicense()

RequestTrialLicense requests a 15 day trial license

func (*Configuration) SetDefaults

func (c *Configuration) SetDefaults()

SetDefaults configures the default values for many configuration options present in the structs. If these values are set in the configuration file they will be overridden

func (*Configuration) SetLicenseSettings

func (c *Configuration) SetLicenseSettings(valid bool, licenseType int)

SetLicenseSettings sets the license status

func (*Configuration) SetSystemUser

func (c *Configuration) SetSystemUser(u *user.User) error

SetSystemUser sets the system user into the configuration then writes it to the disk so that it is persisted on boot

func (*Configuration) WriteToDisk

func (c *Configuration) WriteToDisk() error

WriteToDisk writes the configuration to the disk as a blocking operation by obtating an exclusive lock on the file. This prevens something else from writing at the exact same time and leading to bad data conditions

type LicenseConfiguration

type LicenseConfiguration struct {
	// Indicates if the license is valid, this is checked against a license server when the daemon boots
	ValidLicense bool

	// The panel license type, DNSONLY, Full, or Lite
	LicenseType int
}

LicenseConfiguration defines license configuration settings

type LicenseRequest

type LicenseRequest struct {
	LicenseType int    `json:"type"`
	IP          string `json:"ip"`
}

LicenseRequest is the stucture of the license request

type LicenseVerify

type LicenseVerify struct {
	Valid       bool `json:"valid"`
	LicenseType int  `json:"licenseType"`
}

LicenseVerify contains the responses from the api

type PanelConfiguration

type PanelConfiguration struct {
	// The port the panel uses
	Port int
}

PanelConfiguration defines the panel configuration settings

type SystemConfiguration

type SystemConfiguration struct {
	// Directory of CosmicPanel
	Data string

	// The user used by CosmicPanel
	Username string

	// 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
	}
}

SystemConfiguration defines system configuration settings

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL