๐Ÿ“ฆ GareArc / git-lfs-proxy

๐Ÿ“„ factory.go ยท 25 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25package lfsproxy

import (
	"context"

	"github.com/gorilla/mux"
)

type ProxyHandler interface {
	Init(ctx context.Context, r *mux.Router)
	NotifyInitialized()
}

var (
	proxyFactoryMap map[string]func() ProxyHandler = make(map[string]func() ProxyHandler)
)

func RegisterProxyHandler(name string, builder func() ProxyHandler) {
	proxyFactoryMap[name] = builder
}

func GetProxyHandler(name string) ProxyHandler {
	return proxyFactoryMap[name]()
}