Skip to content

Commit

Permalink
docs(generator): fix typos and better falsy values (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset authored Oct 25, 2023
1 parent 7e10024 commit 2989ab2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/src/components/environment-generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ const Generator = ({ setConfiguration }) => {
name: "instance",
type: "string",
value: "",
env: "MASTODON_INSTANCEBLUESKY_INSTANCE",
env: "MASTODON_INSTANCE",
},
{
name: "token",
type: "string",
value: "",
env: "MASTODON_ACCESS_TOKENBLUESKY_IDENTIFIER",
env: "MASTODON_ACCESS_TOKEN",
},
],
},
Expand Down Expand Up @@ -190,15 +190,18 @@ const Generator = ({ setConfiguration }) => {
return [
builtEnv,
category.fields
.filter((field) => !!field.value)
// Keep booleans and non-empty strings)
.filter((field) =>
typeof field.value === "boolean" ? true : !!field.value,
)
.filter((field) => {
if (field.validationHandler) {
return field.validationHandler(field.value);
}
return true;
})
.map((field) => {
return `${field.env}=${field.value || ""}`;
return `${field.env}=${field.value.toString()}`;
})
.join("\n"),
].join("\n");
Expand Down

0 comments on commit 2989ab2

Please sign in to comment.