@@ -28,9 +28,6 @@ import (
28
28
"github.com/runpod/rplog"
29
29
)
30
30
31
- //go:embed uuid7.js
32
- var uuid7js []byte
33
-
34
31
//go:embed uuid7.py
35
32
var uuid7py []byte
36
33
@@ -147,30 +144,28 @@ def as_rfc3339(dt: datetime.datetime) -> str:
147
144
return dt.astimezone(datetime.timezone.utc).strftime("%%Y-%%m-%%dT%%H:%%M:%%S.%%f")[:-4]+"Z"
148
145
metadata = {
149
146
"instance_id": str(uuid7()),
150
- "service_name ": %q,
151
- "service_env ": %q,
152
- "service_vcs_commit ": %q,
153
- "service_vcs_tag ": %q,
154
- "service_vcs_time ": as_rfc3339(datetime.datetime.fromisoformat(%q)),
155
- "service_vcs_name ": %q,
147
+ "service ": %q,
148
+ "env ": %q,
149
+ "vcs_commit ": %q,
150
+ "vcs_tag ": %q,
151
+ "vcs_time ": as_rfc3339(datetime.datetime.fromisoformat(%q)),
152
+ "vcs_name ": %q,
156
153
}
157
154
`
158
155
fmt .Printf (format , uuid7py , o .Service , o .Env , o .VCSCommit , o .VCSTag , o .VCSTime , o .VCSName )
159
156
case "js" , "javascript" :
160
- // first, we inline the uuid7.js file, then we print the metadata as a javascript object.
161
- const format = `%s
162
- import { uuidv7 } from "uuidv7"
157
+ const format = `import {randomUUID } from "crypto"
163
158
export const metadata = {
164
- instance_id: uuidv7 (),
165
- service_name : %q,
166
- service_env : %q,
167
- service_vcs_commit : %q,
168
- service_vcs_tag : %q,
169
- service_vcs_time : (new Date(%q)).toISOString(),
170
- service_vcs_name : %q,
159
+ instance_id: randomUUID (),
160
+ service : %q,
161
+ env : %q,
162
+ vcs_commit : %q,
163
+ vcs_tag : %q,
164
+ vcs_time : (new Date(%q)).toISOString(),
165
+ vcs_name : %q,
171
166
}
172
167
`
173
- fmt .Printf (format , uuid7js , o .Service , o .Env , o .VCSCommit , o .VCSTag , o .VCSTime , o .VCSName )
168
+ fmt .Printf (format , o .Service , o .Env , o .VCSCommit , o .VCSTag , o .VCSTime , o .VCSName )
174
169
default :
175
170
log .Fatalf ("unknown output format %q" , outputFormat )
176
171
}
0 commit comments