@@ -52,10 +52,6 @@ type API struct {
5252devcontainerNames map [string ]struct {}// Track devcontainer names to avoid duplicates.
5353knownDevcontainers []codersdk.WorkspaceAgentDevcontainer // Track predefined and runtime-detected devcontainers.
5454configFileModifiedTimes map [string ]time.Time // Track when config files were last modified.
55-
56- // experimentalDevcontainersEnabled indicates if the agent is
57- // running in experimental mode with devcontainers enabled.
58- experimentalDevcontainersEnabled bool
5955}
6056
6157// Option is a functional option for API.
@@ -117,9 +113,7 @@ func WithWatcher(w watcher.Watcher) Option {
117113}
118114
119115// NewAPI returns a new API with the given options applied.
120- //
121- //nolint:revive // experimentalDevcontainersEnabled is a control flag.
122- func NewAPI (logger slog.Logger ,experimentalDevcontainersEnabled bool ,options ... Option )* API {
116+ func NewAPI (logger slog.Logger ,options ... Option )* API {
123117ctx ,cancel := context .WithCancel (context .Background ())
124118api := & API {
125119ctx :ctx ,
@@ -133,34 +127,23 @@ func NewAPI(logger slog.Logger, experimentalDevcontainersEnabled bool, options .
133127devcontainerNames :make (map [string ]struct {}),
134128knownDevcontainers : []codersdk.WorkspaceAgentDevcontainer {},
135129configFileModifiedTimes :make (map [string ]time.Time ),
136-
137- experimentalDevcontainersEnabled :experimentalDevcontainersEnabled ,
138130}
139131for _ ,opt := range options {
140132opt (api )
141133}
142- if api .experimentalDevcontainersEnabled {
143- if api .cl == nil {
144- api .cl = NewDocker (api .execer )
145- }
146- if api .dccli == nil {
147- api .dccli = NewDevcontainerCLI (logger .Named ("devcontainer-cli" ),api .execer )
148- }
149- if api .watcher == nil {
150- var err error
151- api .watcher ,err = watcher .NewFSNotify ()
152- if err != nil {
153- logger .Error (ctx ,"create file watcher service failed" ,slog .Error (err ))
154- api .watcher = watcher .NewNoop ()
155- }
156- }
157- }else {
158- if api .cl != nil || api .dccli != nil || api .watcher != nil {
159- logger .Warn (ctx ,"devcontainers are disabled but API is configured with devcontainer services" )
134+ if api .cl == nil {
135+ api .cl = NewDocker (api .execer )
136+ }
137+ if api .dccli == nil {
138+ api .dccli = NewDevcontainerCLI (logger .Named ("devcontainer-cli" ),api .execer )
139+ }
140+ if api .watcher == nil {
141+ var err error
142+ api .watcher ,err = watcher .NewFSNotify ()
143+ if err != nil {
144+ logger .Error (ctx ,"create file watcher service failed" ,slog .Error (err ))
145+ api .watcher = watcher .NewNoop ()
160146}
161- api .cl = & NoopLister {}
162- api .dccli = & noopDevcontainerCLI {}
163- api .watcher = watcher .NewNoop ()
164147}
165148
166149// Make sure we watch the devcontainer config files for changes.
@@ -219,14 +202,6 @@ func (api *API) start() {
219202func (api * API )Routes () http.Handler {
220203r := chi .NewRouter ()
221204
222- if ! api .experimentalDevcontainersEnabled {
223- r .Get ("/" ,api .handleDisabledEmptyList )
224- r .Get ("/devcontainers" ,api .handleDisabled )
225- r .Post ("/{id}/recreate" ,api .handleDisabled )
226-
227- return r
228- }
229-
230205r .Get ("/" ,api .handleList )
231206r .Get ("/devcontainers" ,api .handleListDevcontainers )
232207r .Post ("/{id}/recreate" ,api .handleRecreate )