mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: allow disabling autostart and custom autostop for template (#6933)
API only, frontend in upcoming PR.
This commit is contained in:
@ -122,7 +122,7 @@ type Options struct {
|
||||
DERPMap *tailcfg.DERPMap
|
||||
SwaggerEndpoint bool
|
||||
SetUserGroups func(ctx context.Context, tx database.Store, userID uuid.UUID, groupNames []string) error
|
||||
TemplateScheduleStore schedule.TemplateScheduleStore
|
||||
TemplateScheduleStore *atomic.Pointer[schedule.TemplateScheduleStore]
|
||||
// AppSigningKey denotes the symmetric key to use for signing temporary app
|
||||
// tokens. The key must be 64 bytes long.
|
||||
AppSigningKey []byte
|
||||
@ -235,7 +235,11 @@ func New(options *Options) *API {
|
||||
}
|
||||
}
|
||||
if options.TemplateScheduleStore == nil {
|
||||
options.TemplateScheduleStore = schedule.NewAGPLTemplateScheduleStore()
|
||||
options.TemplateScheduleStore = &atomic.Pointer[schedule.TemplateScheduleStore]{}
|
||||
}
|
||||
if options.TemplateScheduleStore.Load() == nil {
|
||||
v := schedule.NewAGPLTemplateScheduleStore()
|
||||
options.TemplateScheduleStore.Store(&v)
|
||||
}
|
||||
if len(options.AppSigningKey) != 64 {
|
||||
panic("coderd: AppSigningKey must be 64 bytes long")
|
||||
@ -309,7 +313,7 @@ func New(options *Options) *API {
|
||||
),
|
||||
metricsCache: metricsCache,
|
||||
Auditor: atomic.Pointer[audit.Auditor]{},
|
||||
TemplateScheduleStore: atomic.Pointer[schedule.TemplateScheduleStore]{},
|
||||
TemplateScheduleStore: options.TemplateScheduleStore,
|
||||
Experiments: experiments,
|
||||
healthCheckGroup: &singleflight.Group[string, *healthcheck.Report]{},
|
||||
}
|
||||
@ -327,7 +331,6 @@ func New(options *Options) *API {
|
||||
}
|
||||
|
||||
api.Auditor.Store(&options.Auditor)
|
||||
api.TemplateScheduleStore.Store(&options.TemplateScheduleStore)
|
||||
api.workspaceAgentCache = wsconncache.New(api.dialWorkspaceAgentTailnet, 0)
|
||||
api.TailnetCoordinator.Store(&options.TailnetCoordinator)
|
||||
|
||||
@ -770,7 +773,7 @@ type API struct {
|
||||
WorkspaceClientCoordinateOverride atomic.Pointer[func(rw http.ResponseWriter) bool]
|
||||
TailnetCoordinator atomic.Pointer[tailnet.Coordinator]
|
||||
QuotaCommitter atomic.Pointer[proto.QuotaCommitter]
|
||||
TemplateScheduleStore atomic.Pointer[schedule.TemplateScheduleStore]
|
||||
TemplateScheduleStore *atomic.Pointer[schedule.TemplateScheduleStore]
|
||||
|
||||
HTTPAuth *HTTPAuthorizer
|
||||
|
||||
@ -882,7 +885,7 @@ func (api *API) CreateInMemoryProvisionerDaemon(ctx context.Context, debounce ti
|
||||
Tags: tags,
|
||||
QuotaCommitter: &api.QuotaCommitter,
|
||||
Auditor: &api.Auditor,
|
||||
TemplateScheduleStore: &api.TemplateScheduleStore,
|
||||
TemplateScheduleStore: api.TemplateScheduleStore,
|
||||
AcquireJobDebounce: debounce,
|
||||
Logger: api.Logger.Named(fmt.Sprintf("provisionerd-%s", daemon.Name)),
|
||||
})
|
||||
|
Reference in New Issue
Block a user