package main

import (
	"antoine-roux.tk/projects/go/pulumi-library/pkg/application"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {

		nginxApplication, err := application.NewApplication(ctx, &application.Configuration{
			Name:      "nginx",
			Namespace: "pulumi-test",
			Images: []application.ImagesConfiguration{
				{
					Image: "nginx",
				},
				{
					Image:  "nginx",
					Path:   "/api",
					Health: "/",
					Ready:  "/",
				},
			},
			Env: map[string]string{
				"version": "1.0.0",
			},
			Dns:            pulumi.StringRef("pulumi-test-nginx.localdomain"),
			AllowAllOrigin: true,
		})
		if err != nil {
			return err
		}

		ctx.Export("name", nginxApplication.ApplicationName)

		return nil
	})
}
