Maint: alpine package interface rework
- return concrete struct type - split interface is sub-interfaces
This commit is contained in:
@@ -2,24 +2,25 @@
|
||||
package alpine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os/user"
|
||||
)
|
||||
|
||||
type Configurator interface {
|
||||
CreateUser(username string, uid int) (createdUsername string, err error)
|
||||
Version(ctx context.Context) (version string, err error)
|
||||
var _ Alpiner = (*Alpine)(nil)
|
||||
|
||||
type Alpiner interface {
|
||||
UserCreater
|
||||
VersionGetter
|
||||
}
|
||||
|
||||
type configurator struct {
|
||||
type Alpine struct {
|
||||
alpineReleasePath string
|
||||
passwdPath string
|
||||
lookupID func(uid string) (*user.User, error)
|
||||
lookup func(username string) (*user.User, error)
|
||||
}
|
||||
|
||||
func NewConfigurator() Configurator {
|
||||
return &configurator{
|
||||
func New() *Alpine {
|
||||
return &Alpine{
|
||||
alpineReleasePath: "/etc/alpine-release",
|
||||
passwdPath: "/etc/passwd",
|
||||
lookupID: user.LookupId,
|
||||
|
||||
Reference in New Issue
Block a user