configs

package
v0.0.0-...-40d815b Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// GasperConfig is parsed data for `configFile`
	GasperConfig = getConfiguration()

	// MongoConfig is the configuration for MongoDB
	MongoConfig = GasperConfig.Mongo

	// RedisConfig is the configuration for Redis
	RedisConfig = GasperConfig.Redis

	// ServiceConfig is the configuration for all services
	ServiceConfig = GasperConfig.Services

	// CloudflareConfig is the configuration for cloudflare services used by gasper
	CloudflareConfig = GasperConfig.Cloudflare

	// ImageConfig is the configuration for the images used by gasper
	ImageConfig = GasperConfig.Images

	// AdminConfig is the configuration for default Gasper admin
	AdminConfig = GasperConfig.Admin

	// JWTConfig is the configuration for json web auth token
	JWTConfig = GasperConfig.JWT

	//GithubConfig is the authentication configuration for the Gasper Github user
	GithubConfig = GasperConfig.Github

	// ServiceMap is the configuration binding the service name to its
	// deployment status and port
	ServiceMap = map[string]*GenericService{
		types.Master: {
			Deploy: ServiceConfig.Master.Deploy,
			Port:   ServiceConfig.Master.Port,
		},
		types.AppMaker: {
			Deploy: ServiceConfig.AppMaker.Deploy,
			Port:   ServiceConfig.AppMaker.Port,
		},
		types.GenSSH: {
			Deploy: ServiceConfig.GenSSH.Deploy,
			Port:   ServiceConfig.GenSSH.Port,
		},
		types.GenProxy: {
			Deploy: ServiceConfig.GenProxy.Deploy,
			Port:   ServiceConfig.GenProxy.Port,
		},
		types.MongoDB: {
			Deploy: ServiceConfig.DbMaker.MongoDB.PlugIn && ServiceConfig.DbMaker.Deploy,
			Port:   ServiceConfig.DbMaker.Port,
		},
		types.GenDNS: {
			Deploy: ServiceConfig.GenDNS.Deploy,
			Port:   ServiceConfig.GenDNS.Port,
		},
		types.Jikan: {
			Deploy: ServiceConfig.Jikan.Deploy,
			Port:   ServiceConfig.Jikan.Port,
		},
		types.MySQL: {
			Deploy: ServiceConfig.DbMaker.MySQL.PlugIn && ServiceConfig.DbMaker.Deploy,
			Port:   ServiceConfig.DbMaker.Port,
		},
		types.PostgreSQL: {
			Deploy: ServiceConfig.DbMaker.PostgreSQL.PlugIn && ServiceConfig.DbMaker.Deploy,
			Port:   ServiceConfig.DbMaker.Port,
		},
		types.Redis: {
			Deploy: ServiceConfig.DbMaker.Redis.PlugIn && ServiceConfig.DbMaker.Deploy,
			Port:   ServiceConfig.DbMaker.Port,
		},
	}
)

Functions

func CreatePHPContainerConfig

func CreatePHPContainerConfig(name, index string) string

CreatePHPContainerConfig takes the name of the PHP application and generates the container level config for the same Location is the path of index.php, leave empty if same

func CreateStaticContainerConfig

func CreateStaticContainerConfig(name, index string) string

CreateStaticContainerConfig takes the name of the static application and generates the container level config for the same Location is the path of index.html or index.htm, leave empty if same

Types

type Admin

type Admin struct {
	Email    string `toml:"email"`
	Password string `toml:"password"`
	Username string `toml:"username"`
}

Admin is the configuration for the default Admin

type AppMakerService

type AppMakerService struct {
	GenericService
	MetricsInterval time.Duration `toml:"metrics_interval"`
	HealthInterval  time.Duration `toml:"health_interval"`
	AppLimit        int           `toml:"app_limit"`
}

AppMakerService is the default configuration for appmaker microservice

type Cloudflare

type Cloudflare struct {
	PlugIn   bool   `toml:"plugin"`
	PublicIP string `toml:"public_ip"`
	Token    string `toml:"api_token"`
}

Cloudflare is the configuration for cloudflare API

type DatabaseService

type DatabaseService struct {
	PlugIn        bool    `toml:"plugin"`
	ContainerPort int     `toml:"container_port"`
	Env           types.M `toml:"env"`
	Password      string  `toml:"password"`
}

DatabaseService is the configuration for database servers

type DbMakerService

type DbMakerService struct {
	GenericService
	MySQL      DatabaseService `toml:"mysql"`
	MongoDB    DatabaseService `toml:"mongodb"`
	PostgreSQL DatabaseService `toml:"postgresql"`
	Redis      DatabaseService `toml:"redis"`
	DBLimit    int             `toml:"db_limit"`
}

DbMakerService is the configuration for DbMaker microservice

type GasperCfg

type GasperCfg struct {
	Debug       bool       `toml:"debug"`
	Domain      string     `toml:"domain"`
	Secret      string     `toml:"secret"`
	ProjectRoot string     `toml:"project_root"`
	RcFile      string     `toml:"rc_file"`
	OfflineMode bool       `toml:"offline_mode"`
	DNSServers  []string   `toml:"dns_servers"`
	JWT         JWT        `toml:"jwt"`
	Admin       Admin      `toml:"admin"`
	Cloudflare  Cloudflare `toml:"cloudflare"`
	Mongo       Mongo      `toml:"mongo"`
	Redis       Redis      `toml:"redis"`
	Images      Images     `toml:"images"`
	Services    Services   `toml:"services"`
	Github      Github     `toml:"github"`
}

GasperCfg is the configuration for the entire project

type GenDNSService

type GenDNSService struct {
	GenericService
	RecordUpdateInterval time.Duration `toml:"record_update_interval"`
}

GenDNSService is the configuration for GenDNS microservice

type GenProxyService

type GenProxyService struct {
	GenericService
	SSL                  SSLConfig     `toml:"ssl"`
	RecordUpdateInterval time.Duration `toml:"record_update_interval"`
}

GenProxyService is the configuration for GenProxy microservice

type GenSSHService

type GenSSHService struct {
	GenericService
	HostSigners     []string `toml:"host_signers"`
	UsingPassphrase bool     `toml:"using_passphrase"`
	Passphrase      string   `toml:"passphrase"`
	EntrypointIP    string   `toml:"entrypoint_ip"`
}

GenSSHService is the configuration for GenSSH microservice

type GenericService

type GenericService struct {
	Deploy bool `toml:"deploy"`
	Port   int  `toml:"port"`
}

GenericService is the default configuration for all services

type Github

type Github struct {
	Username string `toml:"username"`
	Email    string `toml:"email"`
	PAT      string `toml:"pat"`
}

type Images

type Images struct {
	Static     string `toml:"static"`
	Php        string `toml:"php"`
	Nodejs     string `toml:"nodejs"`
	Python2    string `toml:"python2"`
	Python3    string `toml:"python3"`
	Golang     string `toml:"golang"`
	Ruby       string `toml:"ruby"`
	Rust       string `toml:"rust"`
	Mysql      string `toml:"mysql"`
	Mongodb    string `toml:"mongodb"`
	Postgresql string `toml:"postgresql"`
	Redis      string `toml:"redis"`
}

Images is the configuration for the docker images in use

type JWT

type JWT struct {
	Timeout    time.Duration `toml:"timeout"`
	MaxRefresh time.Duration `toml:"max_refresh"`
}

JWT is the configuration for auth token

type JikanService

type JikanService struct {
	GenericService
}

JikanService is the configuration for Jikan microservice

type MasterService

type MasterService struct {
	GenericService
	CleanupInterval time.Duration   `toml:"cleanup_interval"`
	MongoDB         DatabaseService `toml:"mongodb"`
	Redis           DatabaseService `toml:"redis"`
}

MasterService is the default configuration for Master microservice

type Mongo

type Mongo struct {
	URL string `toml:"url"`
}

Mongo is the configuration for mongodb storage

type Redis

type Redis struct {
	Host     string `toml:"host"`
	Port     int    `toml:"port"`
	Password string `toml:"password"`
	DB       int    `toml:"db"`
}

Redis is the configuration for redis storage

type SSLConfig

type SSLConfig struct {
	PlugIn      bool   `toml:"plugin"`
	Port        int    `toml:"port"`
	Certificate string `toml:"certificate"`
	PrivateKey  string `toml:"private_key"`
}

SSLConfig is the configuration for SSL in GenProxy microservice

type Services

type Services struct {
	ExposureInterval time.Duration   `toml:"exposure_interval"`
	RateInterval     time.Duration   `toml:"rate_interval"`
	RateLimit        int             `toml:"rate_limit"`
	Master           MasterService   `toml:"master"`
	AppMaker         AppMakerService `toml:"appmaker"`
	GenSSH           GenSSHService   `toml:"genssh"`
	GenProxy         GenProxyService `toml:"genproxy"`
	GenDNS           GenDNSService   `toml:"gendns"`
	DbMaker          DbMakerService  `toml:"dbmaker"`
	Jikan            JikanService    `toml:"jikan"`
}

Services is the configuration for all Services

Jump to

Keyboard shortcuts

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