Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aws
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
aws
Commits
ba5cb6a7
Commit
ba5cb6a7
authored
Aug 18, 2024
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inikt
parent
94caa0b4
Pipeline
#209
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
app.js
app.js
+10
-4
No files found.
app.js
View file @
ba5cb6a7
...
...
@@ -14,16 +14,21 @@ if (!fs.existsSync(rootKeyFilePath)) {
function
getAWSCredentials
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
credentials
=
{}
;
let
credentials
=
null
;
fs
.
createReadStream
(
rootKeyFilePath
)
.
pipe
(
csv
())
.
on
(
'
data
'
,
(
row
)
=>
{
credentials
.
accessKeyId
=
row
[
'
Access key ID
'
];
credentials
.
secretAccessKey
=
row
[
'
Secret access key
'
];
console
.
log
(
'
Parsed row:
'
,
row
);
// Log the parsed row for debugging
if
(
row
[
'
Access key ID
'
]
&&
row
[
'
Secret access key
'
])
{
credentials
=
{
accessKeyId
:
row
[
'
Access key ID
'
].
trim
(),
secretAccessKey
:
row
[
'
Secret access key
'
].
trim
(),
};
}
})
.
on
(
'
end
'
,
()
=>
{
if
(
credentials
.
accessKeyId
&&
credentials
.
secretAccessKey
)
{
if
(
credentials
)
{
resolve
(
credentials
);
}
else
{
reject
(
new
Error
(
'
Failed to load AWS credentials from rootkey.csv
'
));
...
...
@@ -66,6 +71,7 @@ async function getLightsailInstances(region, credentials) {
async
function
main
()
{
try
{
const
credentials
=
await
getAWSCredentials
();
console
.
log
(
'
AWS Credentials Loaded:
'
,
credentials
);
// Log loaded credentials for debugging
const
regions
=
getPemFilesAndRegions
();
if
(
regions
.
length
===
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment