kjuulh
46cc160764
updated roadmap updated roadmap Add a basic readme (#15) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: kjuulh/kraken#15 fix readme Add readme with stuff more roadmap items update formatting formatting 2 more setup with semantic with semantic 2 revert add releaserc with releaser with kraken Update roadmap rename rename feature/move-command (#18) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: #18 fix/require-two-pushes (#20) Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: #20
75 lines
2.2 KiB
Go
75 lines
2.2 KiB
Go
package serverdeps
|
|
|
|
import (
|
|
actionc "git.front.kjuulh.io/kjuulh/octopush/internal/actions"
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/gitproviders"
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/services/actions"
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/services/providers"
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/services/signer"
|
|
"git.front.kjuulh.io/kjuulh/octopush/internal/services/storage"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type ServerDeps struct {
|
|
logger *zap.Logger
|
|
|
|
storageConfig *storage.StorageConfig
|
|
gitCfg *providers.GitConfig
|
|
|
|
openPGP *signer.OpenPGP
|
|
}
|
|
|
|
func NewServerDeps(logger *zap.Logger) *ServerDeps {
|
|
deps := &ServerDeps{
|
|
logger: logger.With(zap.Namespace("serverdeps")),
|
|
}
|
|
|
|
if storageCfg, err := storage.NewDefaultStorageConfig(); err != nil {
|
|
panic(err)
|
|
} else {
|
|
deps.storageConfig = storageCfg
|
|
}
|
|
|
|
deps.gitCfg = &providers.GitConfig{
|
|
AuthOption: providers.GIT_AUTH_SSH,
|
|
User: "git",
|
|
Password: "",
|
|
AccessToken: "",
|
|
SshPublicKeyFilePath: "/Users/kah/.ssh/id_ed25519",
|
|
SshPrivateKeyPassword: "",
|
|
}
|
|
|
|
openPGPConfig := &signer.OpenPgpConfig{
|
|
PrivateKeyFilePath: "./example/testkey.private.pgp",
|
|
PrivateKeyPassword: "somepassword",
|
|
PrivateKeyIdentity: "kraken@kasperhermansen.com",
|
|
}
|
|
deps.openPGP = signer.NewOpenPGP(logger.With(zap.Namespace("openpgp")), openPGPConfig)
|
|
|
|
return deps
|
|
}
|
|
|
|
func (deps *ServerDeps) GetStorageService() *storage.Service {
|
|
return storage.NewService(deps.logger.With(zap.Namespace("storage")), deps.storageConfig)
|
|
}
|
|
|
|
func (deps *ServerDeps) GetGitProvider() *providers.GoGit {
|
|
return providers.NewGit(deps.logger.With(zap.Namespace("gitProvider")), deps.gitCfg, deps.openPGP)
|
|
}
|
|
|
|
func (deps *ServerDeps) GetAction() *actions.Action {
|
|
return actions.NewAction(deps.logger.With(zap.Namespace("action")))
|
|
}
|
|
|
|
func (deps *ServerDeps) GetActionCreator() *actionc.ActionCreator {
|
|
return actionc.NewActionCreator(deps.logger.With(zap.Namespace("action")), deps)
|
|
}
|
|
|
|
func (deps *ServerDeps) GetGitea() *gitproviders.Gitea {
|
|
return gitproviders.NewGitea(deps.logger.With(zap.Namespace("gitea")))
|
|
}
|
|
|
|
func (deps *ServerDeps) GetOpenPGP() *signer.OpenPGP {
|
|
return deps.openPGP
|
|
}
|