4
4
"bytes"
5
5
"embed"
6
6
"fmt"
7
+ proApi "github.com/semaphoreui/semaphore/pro/api"
7
8
proFeatures "github.com/semaphoreui/semaphore/pro/pkg/features"
8
9
"github.com/semaphoreui/semaphore/services/server"
9
10
task2 "github.com/semaphoreui/semaphore/services/tasks"
@@ -15,6 +16,7 @@ import (
15
16
16
17
"github.com/semaphoreui/semaphore/api/debug"
17
18
"github.com/semaphoreui/semaphore/pkg/tz"
19
+ proSubscriptions "github.com/semaphoreui/semaphore/pro/api/subscriptions"
18
20
log "github.com/sirupsen/logrus"
19
21
20
22
"github.com/semaphoreui/semaphore/api/runners"
@@ -97,6 +99,7 @@ func Route(
97
99
repositoryController := projects .NewRepositoryController (accessKeyInstallationService )
98
100
keyController := projects .NewKeyController (accessKeyService )
99
101
projectsController := projects .NewProjectsController (accessKeyService )
102
+ terraformController := proApi .NewTerraformController (encryptionService )
100
103
101
104
r := mux .NewRouter ()
102
105
r .NotFoundHandler = http .HandlerFunc (servePublic )
@@ -153,11 +156,11 @@ func Route(
153
156
integrationController .ReceiveIntegration ).Methods ("POST" , "GET" , "OPTIONS" )
154
157
155
158
terraformWebhookRouter := publicWebHookRouter .PathPrefix ("/terraform" ).Subrouter ()
156
- terraformWebhookRouter .Use (TerraformInventoryAliasMiddleware )
157
- terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (getTerraformState ).Methods ("GET" )
158
- terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (addTerraformState ).Methods ("POST" )
159
- terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (lockTerraformState ).Methods ("LOCK" )
160
- terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (unlockTerraformState ).Methods ("UNLOCK" )
159
+ terraformWebhookRouter .Use (terraformController . TerraformInventoryAliasMiddleware )
160
+ terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (terraformController . GetTerraformState ).Methods ("GET" )
161
+ terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (terraformController . AddTerraformState ).Methods ("POST" )
162
+ terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (terraformController . LockTerraformState ).Methods ("LOCK" )
163
+ terraformWebhookRouter .Path ("/{alias}" ).HandlerFunc (terraformController . UnlockTerraformState ).Methods ("UNLOCK" )
161
164
162
165
authenticatedWS := r .PathPrefix (webPath + "api" ).Subrouter ()
163
166
authenticatedWS .Use (JSONMiddleware , authenticationWithStore )
@@ -168,6 +171,9 @@ func Route(
168
171
169
172
authenticatedAPI .Path ("/info" ).HandlerFunc (getSystemInfo ).Methods ("GET" , "HEAD" )
170
173
174
+ authenticatedAPI .Path ("/subscription" ).HandlerFunc (proSubscriptions .Activate ).Methods ("POST" )
175
+ authenticatedAPI .Path ("/subscription" ).HandlerFunc (proSubscriptions .GetSubscription ).Methods ("GET" )
176
+
171
177
authenticatedAPI .Path ("/projects" ).HandlerFunc (projects .GetProjects ).Methods ("GET" , "HEAD" )
172
178
authenticatedAPI .Path ("/projects" ).HandlerFunc (projectsController .AddProject ).Methods ("POST" )
173
179
authenticatedAPI .Path ("/projects/restore" ).HandlerFunc (projects .Restore ).Methods ("POST" )
@@ -599,6 +605,10 @@ func getSystemInfo(w http.ResponseWriter, r *http.Request) {
599
605
}
600
606
}
601
607
608
+ if util .Config .Auth .Email .Enabled {
609
+ authMethods .Email = & LoginEmailAuthMethod {}
610
+ }
611
+
602
612
body := map [string ]any {
603
613
"version" : util .Version (),
604
614
"ansible" : util .AnsibleVersion (),
0 commit comments