PLT-6408 Framework for job server (#6404)
* Added initial job server * Added job server to be ran as part of platform * Added test job to the enterprise repo * Fixed job server not loading license * Renamed job package to jobs * Fixed TE not being buildable * Added JobStatus table to database * Changed fields used by JobStatus * Added APIs to query job status * Added config change listener to server * Added option to run job server from Makefile * Added ability to enable/disable jobs from config * Commented out placeholder for search indexing job * Fixed govet * Removed debug messages and fixed job api init message
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
920bc0d871
Коммит
577ed27f1b
@@ -114,6 +114,25 @@ func ValidateLicense(signed []byte) (bool, string) {
|
||||
return true, string(plaintext)
|
||||
}
|
||||
|
||||
func GetAndValidateLicenseFileFromDisk() (*model.License, []byte) {
|
||||
fileName := GetLicenseFileLocation(*Cfg.ServiceSettings.LicenseFileLocation)
|
||||
|
||||
if _, err := os.Stat(fileName); err != nil {
|
||||
l4g.Debug("We could not find the license key in the database or on disk at %v", fileName)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
l4g.Info("License key has not been uploaded. Loading license key from disk at %v", fileName)
|
||||
licenseBytes := GetLicenseFileFromDisk(fileName)
|
||||
|
||||
if success, licenseStr := ValidateLicense(licenseBytes); !success {
|
||||
l4g.Error("Found license key at %v but it appears to be invalid.", fileName)
|
||||
return nil, nil
|
||||
} else {
|
||||
return model.LicenseFromJson(strings.NewReader(licenseStr)), licenseBytes
|
||||
}
|
||||
}
|
||||
|
||||
func GetLicenseFileFromDisk(fileName string) []byte {
|
||||
file, err := os.Open(fileName)
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user