@@ -326,6 +326,27 @@ func loadAzureAppConfiguration(ctx context.Context) (*azureappconfiguration.Azur
326
326
1 . Create a file named ` main.go ` with the following content.
327
327
328
328
``` golang
329
+ package main
330
+
331
+ import (
332
+ " context"
333
+ " fmt"
334
+ " log"
335
+ " net/http"
336
+ " strings"
337
+
338
+ " github.com/gin-contrib/sessions"
339
+ " github.com/gin-contrib/sessions/cookie"
340
+ " github.com/gin-gonic/gin"
341
+ " github.com/microsoft/Featuremanagement-Go/featuremanagement"
342
+ " github.com/microsoft/Featuremanagement-Go/featuremanagement/providers/azappconfig"
343
+ )
344
+
345
+ type WebApp struct {
346
+ featureManager *featuremanagement.FeatureManager
347
+ appConfig *azureappconfiguration.AzureAppConfiguration
348
+ }
349
+
329
350
func main () {
330
351
// Load Azure App Configuration
331
352
appConfig , err := loadAzureAppConfiguration (context.Background ())
@@ -355,12 +376,13 @@ func loadAzureAppConfiguration(ctx context.Context) (*azureappconfiguration.Azur
355
376
r := gin.Default ()
356
377
357
378
// Start server
358
- fmt.Println (" Starting server on http://localhost:8080" )
359
- fmt.Println (" Open http://localhost:8080 in your browser" )
360
- fmt.Println ()
361
379
if err := r.Run (" :8080" ); err != nil {
362
380
log.Fatalf (" Failed to start server: %v " , err)
363
381
}
382
+
383
+ fmt.Println (" Starting server on http://localhost:8080" )
384
+ fmt.Println (" Open http://localhost:8080 in your browser" )
385
+ fmt.Println ()
364
386
}
365
387
```
366
388
@@ -530,8 +552,9 @@ func loadAzureAppConfiguration(ctx context.Context) (*azureappconfiguration.Azur
530
552
app.setupRoutes(r)
531
553
532
554
// Start server
533
- fmt.Println("Starting server on http://localhost:8080")
534
-
555
+ if err := r.Run(":8080"); err != nil {
556
+ log.Fatalf("Failed to start server: %v", err)
557
+ }
535
558
// The rest of existing code
536
559
// ... ...
537
560
` ` `
@@ -546,7 +569,6 @@ func loadAzureAppConfiguration(ctx context.Context) (*azureappconfiguration.Azur
546
569
"fmt"
547
570
"log"
548
571
"net/http"
549
- "os"
550
572
"strings"
551
573
552
574
"github.com/gin-contrib/sessions"
@@ -728,12 +750,13 @@ func loadAzureAppConfiguration(ctx context.Context) (*azureappconfiguration.Azur
728
750
app.setupRoutes(r)
729
751
730
752
// Start server
731
- fmt.Println("Starting server on http://localhost:8080")
732
- fmt.Println("Open http://localhost:8080 in your browser")
733
- fmt.Println()
734
753
if err := r.Run(":8080"); err != nil {
735
754
log.Fatalf("Failed to start server: %v", err)
736
755
}
756
+
757
+ fmt.Println("Starting server on http://localhost:8080")
758
+ fmt.Println("Open http://localhost:8080 in your browser")
759
+ fmt.Println()
737
760
}
738
761
` ` `
739
762
0 commit comments