-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variable interpreted as a string #309
Comments
Hmmm. That does sound broken. Thanks for the bug report. It's weird that your application options is logged as: I haven't had a chance to play with the container with ECS, EKS, or Fargate yet so this might take me a bit of time. I'm just going to paste some context below... I'm not going to be able to dig into it tonight, but I'll try to take a look tomorrow. foundryvtt-docker/src/set_options.ts Line 41 in d6a9467
From: https://github.com/felddy/foundryvtt-docker#optional
|
No worries. I'll play around with a bit, and see if I can't figure it out and get a PR going. Thanks for the reply! |
I'm guessing this is a type coercion issue, and I've never done anything in JavaScript but this seems to fix it: function checkAwsConfig(
AWS_CONFIG: string | any
) : boolean | string {
if (!AWS_CONFIG) {
return AWS_CONFIG;
} else if (AWS_CONFIG.toLowerCase() === 'true') {
return true;
} else if (AWS_CONFIG.toLowerCase() === 'false') {
return false;
} else {
return AWS_CONFIG;
}
}
if (process.env.FOUNDRY_DEMO_CONFIG) {
parsedDemoConfig = JSON.parse(process.env.FOUNDRY_DEMO_CONFIG);
}
let options: object = {
awsConfig: checkAwsConfig(process.env.FOUNDRY_AWS_CONFIG) || null, Guessing you'll want something cleaner in a PR, so I won't open one. |
🐛 Bug Report
I'm using AWS ECS, which gets it's IAM credentials the same way an EC2 instnace would. Setting the FOUNDRY_AWS_CONFIG environment variable to "true" causes it to be read as a string, and it subsequently gets added to the path:
The configured awsConfig path /data/Config/true does not exist or is not accessible.
. This should not happen, as ECS gets it's IAM credentials the same way that EC2 does.To Reproduce
Steps to reproduce the behavior:
Set environment variable as "true", get error.
Expected behavior
I expected it to not use any file, or environment variables and use the attached IAM policy instead. I'm not sure if the entrypoint, or later javascript is expected that to be a bool without quotes, but perhaps there should be a check in there to see if the string evaluates to true or false.
Any helpful log output
Please run this command:
Paste the results here:
Hopefully this is legibly formatted
Run the container with
CONTAINER_VERBOSE
set totrue
,and paste any usefullog output here:
The text was updated successfully, but these errors were encountered: