working on code breakup
Build and Push Image / build-and-push (push) Failing after 21s

This commit is contained in:
2026-05-02 23:29:32 -07:00
parent 749fe95903
commit b39fc6e7db
6 changed files with 103 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import config from './config.js';
const username = process.env.KOILLECTION_USERNAME;
const password = process.env.KOILLECTION_PASSWORD;
export async function createJWTToken() {
try {
const response = await fetch(`${config.baseUrl}/authentication_token`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ username, password }),
});
if (!response.ok) {
throw new Error(`Failed to obtain JWT token: ${response.status} - ${response.statusText}`);
}
const data = await response.json();
console.log(`JWT Token obtained: ${data.token}`);
return data.token;
} catch (error) {
console.error(`Error obtaining JWT token:`, error);
throw error; // Re-throw to be caught in other functions
}
}