-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfig.go
More file actions
107 lines (95 loc) · 2.55 KB
/
Copy pathconfig.go
File metadata and controls
107 lines (95 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package dewy
import (
"time"
"github.com/linyows/dewy/container"
starter "github.com/linyows/server-starter"
)
// Command for CLI.
type Command int
const (
// SERVER command.
SERVER Command = iota
// ASSETS command.
ASSETS
// CONTAINER command.
CONTAINER
)
// String to string for Command.
func (c Command) String() string {
switch c {
case SERVER:
return "server"
case ASSETS:
return "assets"
case CONTAINER:
return "container"
default:
return "unknown"
}
}
// CacheType for cache type.
type CacheType int
const (
// NONE cache type.
NONE CacheType = iota
// FILE cache type.
FILE
)
// String to string for CacheType.
func (c CacheType) String() string {
switch c {
case NONE:
return "none"
case FILE:
return "file"
default:
return "unknown"
}
}
// CacheConfig struct.
type CacheConfig struct {
Type CacheType
Expiration int
// URL selects a cache backend by scheme.
// Examples: "" (default file), "file:///path/to/cache",
// "s3://<region>/<bucket>/<prefix>", "gs://<bucket>/<prefix>".
URL string
}
// ContainerConfig struct for container command.
type ContainerConfig struct {
Name string
PortMappings []container.PortMapping // Port mappings between proxy and container (ContainerPort==0 means auto-detect from image EXPOSE)
Replicas int // Number of container replicas to run (default: 1)
Command []string // Command and arguments to pass to container
ExtraArgs []string // Extra docker run arguments from -- separator
HealthPath string
HealthTimeout time.Duration
DrainTime time.Duration
Runtime string // "docker" or "podman"
ProxyIdleTimeout time.Duration // Idle timeout for TCP proxy connections (0 = disabled)
}
// Config struct.
type Config struct {
Command Command
Registry string
Notifier string
Port int // Port for HTTP server (used by both server and container commands)
AdminPort int // Port for admin API (container command only, default: 17539)
Cache CacheConfig
Starter starter.Config
Container *ContainerConfig
BeforeDeployHook string
AfterDeployHook string
Slot string // Deployment slot for blue/green deployment (e.g., "blue", "green")
CalVer string // CalVer format for version identification (e.g., "YYYY.0M.MICRO")
*Info
}
// DefaultConfig returns default Config.
func DefaultConfig() Config {
return Config{
Cache: CacheConfig{
Type: FILE,
Expiration: 10,
},
}
}