@@ -7,15 +7,12 @@ import (
7
7
"encoding/pem"
8
8
"fmt"
9
9
"log"
10
- "strings "
10
+ "os "
11
11
"time"
12
12
13
13
defangclient "github.com/DefangLabs/defang/src/pkg/cli/client"
14
14
"github.com/DefangLabs/defang/src/pkg/types"
15
15
defangv1 "github.com/DefangLabs/defang/src/protos/io/defang/v1"
16
- "github.com/aws/aws-sdk-go-v2/config"
17
- "github.com/aws/aws-sdk-go-v2/service/ssm"
18
- "github.com/aws/smithy-go/ptr"
19
16
"github.com/golang-jwt/jwt/v5"
20
17
)
21
18
@@ -25,28 +22,8 @@ type TokenIssuer struct {
25
22
}
26
23
27
24
func NewTokenIssuer (ctx context.Context , cluster string ) (* TokenIssuer , error ) {
28
- parts := strings .Split (strings .TrimPrefix (cluster , "fabric-" ), "." )
29
- if len (parts ) < 2 {
30
- return nil , fmt .Errorf ("invalid cluster: %v" , cluster )
31
- }
32
- stack := parts [0 ]
33
-
34
- config , err := config .LoadDefaultConfig (ctx )
35
- if err != nil {
36
- return nil , fmt .Errorf ("unable to load SDK config: %w" , err )
37
- }
38
-
39
- ssmClient := ssm .NewFromConfig (config )
40
- privateKeyParamName := fmt .Sprintf ("/ecs/%v/fixed-verifier-private-key-ed25519-pem" , stack )
41
- out , err := ssmClient .GetParameter (ctx , & ssm.GetParameterInput {
42
- Name : ptr .String (privateKeyParamName ),
43
- WithDecryption : ptr .Bool (true ),
44
- })
45
- if err != nil {
46
- return nil , fmt .Errorf ("failed to get fixed verifier key at %v parameter: %w" , privateKeyParamName , err )
47
- }
48
-
49
- pk , err := decodePrivateKeyPEM (* out .Parameter .Value )
25
+ fixedVerifierPk := os .Getenv ("FIXED_VERIFIER_PK" )
26
+ pk , err := decodePrivateKeyPEM (fixedVerifierPk )
50
27
if err != nil {
51
28
return nil , fmt .Errorf ("failed to parse fixed verifier key: %w" , err )
52
29
}
0 commit comments