Sybren A. Stüvel
02fac6a4df
Change the package base name of the Go code, from `git.blender.org/flamenco` to `projects.blender.org/studio/flamenco`. The old location, `git.blender.org`, has no longer been use since the [migration to Gitea][1]. The new package names now reflect the actual location where Flamenco is hosted. [1]: https://code.blender.org/2023/02/new-blender-development-infrastructure/
41 lines
924 B
Go
41 lines
924 B
Go
package stresser
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import (
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"projects.blender.org/studio/flamenco/internal/worker"
|
|
)
|
|
|
|
type FakeConfig struct {
|
|
creds worker.WorkerCredentials
|
|
}
|
|
|
|
func NewFakeConfig(workerID, workerSecret string) *FakeConfig {
|
|
return &FakeConfig{
|
|
creds: worker.WorkerCredentials{
|
|
WorkerID: workerID,
|
|
Secret: workerSecret,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (fc *FakeConfig) WorkerConfig() (worker.WorkerConfig, error) {
|
|
config := worker.NewConfigWrangler().DefaultConfig()
|
|
config.ManagerURL = "http://localhost:8080/"
|
|
return config, nil
|
|
}
|
|
|
|
func (fc *FakeConfig) WorkerCredentials() (worker.WorkerCredentials, error) {
|
|
return fc.creds, nil
|
|
}
|
|
|
|
func (fc *FakeConfig) SaveCredentials(creds worker.WorkerCredentials) error {
|
|
log.Info().
|
|
Str("workerID", creds.WorkerID).
|
|
Str("workerSecret", creds.Secret).
|
|
Msg("remember these credentials for next time")
|
|
return nil
|
|
}
|