github.com/semaphoreui/semaphore/util
No package summary is available.
Package
Files: 8. Third party imports: 5. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Constants
Vars
Config exposes the application configuration storage for use in the application
Cookie is a runtime generated secure cookie used for authentication
WebHostURL is the public route to the semaphore server
ansiCodeRE is a regex to remove ANSI escape sequences from a string. ANSI escape sequences are typically in the form: \x1b[<parameters><letter>
https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
Types
App
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Active |
|
No comment on field. |
| Priority |
|
No comment on field. |
| Title |
|
No comment on field. |
| Icon |
|
No comment on field. |
| Color |
|
No comment on field. |
| DarkColor |
|
No comment on field. |
| AppPath |
|
No comment on field. |
| AppArgs |
|
No comment on field. |
AuthConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Totp |
|
No comment on field. |
ClaimsProvider
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
ConfigLog
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Events |
|
No comment on field. |
| Tasks |
|
No comment on field. |
ConfigProcess
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| User |
|
No comment on field. |
| UID |
|
No comment on field. |
| Chroot |
|
No comment on field. |
| GID |
|
No comment on field. |
ConfigType
ConfigType mapping between Config and the json file that sets it
| Field name | Field type | Comment |
|---|---|---|
| MySQL |
|
No comment on field. |
| BoltDb |
|
No comment on field. |
| Postgres |
|
No comment on field. |
| Dialect |
|
No comment on field. |
| Port |
|
Format |
| TLS |
|
No comment on field. |
| Auth |
|
No comment on field. |
| Interface |
|
Interface ip, put in front of the port. defaults to empty |
| TmpPath |
|
semaphore stores ephemeral projects here |
| SshConfigPath |
|
SshConfigPath is a path to the custom SSH config file. Default path is ~/.ssh/config. |
| GitClientId |
|
No comment on field. |
| WebHost |
|
web host |
| CookieHash |
|
cookie hashing & encryption |
| CookieEncryption |
|
No comment on field. |
| AccessKeyEncryption |
|
AccessKeyEncryption is BASE64 encoded byte array used for encrypting and decrypting access keys stored in database. |
| EmailAlert |
|
email alerting |
| EmailSender |
|
No comment on field. |
| EmailHost |
|
No comment on field. |
| EmailPort |
|
No comment on field. |
| EmailUsername |
|
No comment on field. |
| EmailPassword |
|
No comment on field. |
| EmailSecure |
|
No comment on field. |
| EmailTls |
|
No comment on field. |
| EmailTlsMinVersion |
|
No comment on field. |
| LdapEnable |
|
ldap settings |
| LdapBindDN |
|
No comment on field. |
| LdapBindPassword |
|
No comment on field. |
| LdapServer |
|
No comment on field. |
| LdapSearchDN |
|
No comment on field. |
| LdapSearchFilter |
|
No comment on field. |
| LdapMappings |
|
No comment on field. |
| LdapNeedTLS |
|
No comment on field. |
| TelegramAlert |
|
Telegram, Slack, Rocket.Chat, Microsoft Teams, DingTalk, and Gotify alerting |
| TelegramChat |
|
No comment on field. |
| TelegramToken |
|
No comment on field. |
| SlackAlert |
|
No comment on field. |
| SlackUrl |
|
No comment on field. |
| RocketChatAlert |
|
No comment on field. |
| RocketChatUrl |
|
No comment on field. |
| MicrosoftTeamsAlert |
|
No comment on field. |
| MicrosoftTeamsUrl |
|
No comment on field. |
| DingTalkAlert |
|
No comment on field. |
| DingTalkUrl |
|
No comment on field. |
| GotifyAlert |
|
No comment on field. |
| GotifyUrl |
|
No comment on field. |
| GotifyToken |
|
No comment on field. |
| OidcProviders |
|
oidc settings |
| MaxTaskDurationSec |
|
No comment on field. |
| MaxTasksPerTemplate |
|
No comment on field. |
| MaxParallelTasks |
|
task concurrency |
| RunnerRegistrationToken |
|
No comment on field. |
| PasswordLoginDisable |
|
feature switches |
| NonAdminCanCreateProject |
|
No comment on field. |
| UseRemoteRunner |
|
No comment on field. |
| IntegrationAlias |
|
No comment on field. |
| Apps |
|
No comment on field. |
| Runner |
|
No comment on field. |
| EnvVars |
|
No comment on field. |
| ForwardedEnvVars |
|
No comment on field. |
| Log |
|
No comment on field. |
| Process |
|
No comment on field. |
| Schedule |
|
No comment on field. |
| Debugging |
|
No comment on field. |
DbConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Dialect |
|
No comment on field. |
| Hostname |
|
No comment on field. |
| Username |
|
No comment on field. |
| Password |
|
No comment on field. |
| DbName |
|
No comment on field. |
| Options |
|
No comment on field. |
DebuggingConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ApiDelay |
|
No comment on field. |
| PprofDumpDir |
|
No comment on field. |
EventLogAction
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
EventLogRecord
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Action |
|
No comment on field. |
| UserID |
|
No comment on field. |
| IntegrationID |
|
No comment on field. |
| ProjectID |
|
No comment on field. |
| Description |
|
No comment on field. |
EventLogType
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Format |
|
No comment on field. |
| Enabled |
|
No comment on field. |
| Logger |
|
No comment on field. |
FileLogFormat
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| type |
|
No comment on field. |
LdapMappings
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| DN |
|
No comment on field. |
|
No comment on field. | |
| UID |
|
No comment on field. |
| CN |
|
No comment on field. |
OidcProvider
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| ClientID |
|
No comment on field. |
| ClientIDFile |
|
No comment on field. |
| ClientSecret |
|
No comment on field. |
| ClientSecretFile |
|
No comment on field. |
| RedirectURL |
|
No comment on field. |
| Scopes |
|
No comment on field. |
| DisplayName |
|
No comment on field. |
| Color |
|
No comment on field. |
| Icon |
|
No comment on field. |
| AutoDiscovery |
|
No comment on field. |
| Endpoint |
|
No comment on field. |
| UsernameClaim |
|
No comment on field. |
| NameClaim |
|
No comment on field. |
| EmailClaim |
|
No comment on field. |
| Order |
|
No comment on field. |
RunnerConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| RegistrationToken |
|
No comment on field. |
| Token |
|
No comment on field. |
| TokenFile |
|
No comment on field. |
| PrivateKeyFile |
|
No comment on field. |
| OneOff |
|
OneOff indicates than runner runs only one job and exit. It is very useful for dynamic runners. How it works? Example:
|
| Webhook |
|
No comment on field. |
| MaxParallelTasks |
|
No comment on field. |
ScheduleConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Timezone |
|
No comment on field. |
TLSConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Enabled |
|
No comment on field. |
| CertFile |
|
No comment on field. |
| KeyFile |
|
No comment on field. |
| HTTPRedirectPort |
|
No comment on field. |
TaskLogRecord
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Username |
|
No comment on field. |
| TaskID |
|
No comment on field. |
| ProjectID |
|
No comment on field. |
| TemplateID |
|
No comment on field. |
| TemplateName |
|
No comment on field. |
| UserID |
|
No comment on field. |
| Description |
|
No comment on field. |
| RunnerID |
|
No comment on field. |
| Status |
|
No comment on field. |
TaskLogType
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Enabled |
|
No comment on field. |
| Format |
|
No comment on field. |
| Logger |
|
No comment on field. |
| ResultLogger |
|
No comment on field. |
TotpConfig
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| Enabled |
|
No comment on field. |
| AllowRecovery |
|
No comment on field. |
oidcEndpoint
This type doesn't have documentation.
| Field name | Field type | Comment |
|---|---|---|
| IssuerURL |
|
No comment on field. |
| AuthURL |
|
No comment on field. |
| TokenURL |
|
No comment on field. |
| UserInfoURL |
|
No comment on field. |
| JWKSURL |
|
No comment on field. |
| Algorithms |
|
No comment on field. |
Functions
func AnsibleVersion
func AssignMapToStruct
func CastValueToKind
func CheckUpdate
CheckUpdate uses the GitHub client to check for new tags in the semaphore repo
Uses: context.TODO, github.NewClient.func ClearDir
func ClearFromAnsiCodes
func ConfigInit
ConfigInit reads in cli flags, and switches actions appropriately on them
Uses: base64.StdEncoding, fmt.Println, os.ReadFile, securecookie.New, strings.TrimSpace, url.Parse.func FindSemaphore
FindSemaphore looks in the PATH for the semaphore variable if not found it will attempt to find the absolute path of the first os argument, the semaphore command, and return it
Uses: exec.LookPath, filepath.Abs, os.Args.func GeneratePrivateKey
func GenerateRecoveryCode
func GetPublicAliasURL
func GetPublicHost
func Goid
func LogDebugF
LogDebugF logs a debug with added field context if error
Uses: log.WithFields.func LogError
LogError logs an error with arbitrary field if error
Uses: log.Fields.func LogErrorF
LogErrorF logs a error with added field context if error
Uses: log.WithFields.func LogGoid
func LogPanic
LogPanic logs and panics with arbitrary field if error
Uses: log.Fields.func LogPanicF
LogPanicF logs and panics with added field context if error
Uses: log.WithFields.func LogWarning
LogWarning logs a warning with arbitrary field if error
Uses: log.Fields.func LogWarningF
LogWarningF logs a warning with added field context if error
Uses: log.WithFields.func LookupDefaultApps
func NewConfigType
func RandString
func VerifyRecoveryCode
func Version
func (*ConfigType) ClearProjectTmpDir
func (*ConfigType) ClearTmpDir
func (*ConfigType) GenerateSecrets
GenerateSecrets generates cookie secret during setup
Uses: base64.StdEncoding, securecookie.GenerateRandomKey.func (*ConfigType) GetDBConfig
func (*ConfigType) GetDialect
func (*ConfigType) GetProjectTmpDir
func (*ConfigType) GetSysProcAttr
func (*ConfigType) PrintDbInfo
PrintDbInfo prints the database connection information based on the current configuration. It retrieves the database dialect and prints the corresponding connection details. If the dialect is not found, it panics with an error message.
Uses: fmt.Errorf, fmt.Printf.func (*ConfigType) ToJSON
ToJSON returns a JSON string of the config
Uses: json.MarshalIndent.func (*DbConfig) GetConnectionString
GetConnectionString constructs the database connection string based on the current configuration. It supports MySQL, BoltDB, and PostgreSQL dialects. If the dialect is unsupported, it returns an error.
Parameters:
- includeDbName: a boolean indicating whether to include the database name in the connection string.
Returns:
- connectionString: the constructed database connection string.
- err: an error if the dialect is unsupported.
func (*DbConfig) GetDbName
func (*DbConfig) GetHostname
func (*DbConfig) GetPassword
func (*DbConfig) GetUsername
func (*DbConfig) HasSupportMultipleDatabases
func (*DbConfig) IsPresent
func (*EventLogType) Write
func (*LdapMappings) GetEmailClaim
func (*LdapMappings) GetNameClaim
func (*LdapMappings) GetUsernameClaim
func (*OidcProvider) GetEmailClaim
func (*OidcProvider) GetNameClaim
func (*OidcProvider) GetUsernameClaim
func (*TaskLogType) Write
Private functions
func assignMapToStructRecursive
func castStringToBool
func castStringToInt
func cloneStruct
func decodeConfig
func exitOnConfigError
func exitOnConfigFileError
func getConfigValue
func loadConfigDefaults
func loadConfigEnvironment
func loadConfigFile
func loadDefaultsToObject
func loadEnvironmentToObject
func mapToQueryString
func setConfigValue
func validate
func validateConfig
Tests
Files: 1. Third party imports: 0. Imports from organisation: 0. Tests: 12. Benchmarks: 0.