Skip to content

Update env variables docs #2375

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

Merged
merged 7 commits into from
Dec 19, 2024
Merged

Conversation

infomiho
Copy link
Contributor

@infomiho infomiho commented Nov 19, 2024

Updates the Project and Deployment env variables docs. I've tried to deduplicate as much as possible. I've enumerate all the env variables that Wasp defines.

Closes #1894

Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff! Once we solve all these comments, I will take another look but more from the high above, to get a better grasp for where is what and what are the relations, now I was focusing more on the details. But I think the question is similar like in other PR: Do we do A.P B.P and then link from P to those, or do we do P.A and P.B and then link from A and B to those, where are parts of docs about Production and A and B are some features (check the other PR for more info).

`.env.server` should not be committed to version control as it can contain secrets, while `.env.client` can be versioned as it must not contain any secrets.
By default, in the `.gitignore` file that comes with a new Wasp app, we ignore all dotenv files.

:::info Dotenv files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did this go, it wasn't useful?

Copy link
Contributor Author

@infomiho infomiho Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't feel useful to me, it talks about the specific Node.js package and they are not going to use it directly. I think the env vars file format is self-explanatory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They might need to understand how to use it though, to for example pass JSON values and similar, we had those situations, how to quote stuff. So I thoguht it is good to introduce the concept, since we are using it as na important part of Wasp, so it is clear this is not something we made up, but instead there are more resources behind it that they can look for. Drop it if you really want, but to me it seems useful to keep it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get what you mean, if people know what's underneath they can Google better.

The env variables are first parsed by Haskell and then outputted to the .env files in the server and the client apps. If we wanted to provide full information, we should first mention Haskell's dotenv package and then our logic for outputting the vars i.e. our envVarsToDotEnvContent function. And then we can mention that the variables are ingested by Node.js with the JS dotenv package.

I dislike giving this many details to users because 99% of them don't really need them and those with issues will most likely ask about it in our Discord.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that what we had was happy middle though. But again, as I said, do as you like here, I provided my perspective as hopefully a helpful thing, I dont' have much more to say than what I already said, you will makeo ok choice whatever it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this is cool! I found it a bit weird that I have to construct EnvVar elements outside and then provide them as children, to me it sounded more natural to provide a list of EnvVar objects to the EnvVarsTable and then it would call .map on those and produce a bunch of EnvVar elements that show those. But ok it is quite unimportant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-12-11 at 15 13 10

I got inspired by ShadCN's way of composing things.

Copy link
Member

@Martinsos Martinsos Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but they can combine multiple things, maybe it is Item, maybe it is Separator. You instead have a single item that can go in. So no composability, but you opened space for throwing in random elements that don't make sense. Btw do they somehow protect against being given children that you are not supposed to pass? Also they might have different reasons for this kind of design, including uniformity with the rest of the design the have or whatever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compare
Screenshot 2024-12-16 at 15 55 03
vs.
Screenshot 2024-12-16 at 15 55 11

One of them is more readable to me, so I'd like to keep the current API. It's our internal component for docs, no need to make it so strict IMHO.

Copy link
Member

@Martinsos Martinsos Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more readable because you used different vars! The second example has less vars, the first and second, and third and forth, have equal length of name, and they all have much shorter notes. So there is less content, it is better aligned, and on top of all that it allowed you to zoom in so that also looks better.
Finally, your editor seems to do a better job with syntax coloring in the second example, but I don't see why it couldn't do coloring well also in the first example, I just tried this in my emacs and it does the coloring properly. Maybe that <span> in that note causes you issues? That works fine for me though.

Take a look at what it looks in my emacs, when I use the same env vars:

image

image

Those look exactly the same regarding readibility to me. If anything, you could argue that the first one has a bit less noise due to less repetitive HTML tags, although I don't think it matters.

Also, while doing the comparison, you ignored my argument about the second approach (one with children) allowing for elements that you might not expect, while the first one doesn't allow that.

Keep the API as you like it, as I said in my initial comment, this is quite unimportant, but still I think this discussion is useful as a learning opportunity and didn't want it to end with wrong arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the API 👍

@infomiho infomiho requested a review from Martinsos December 11, 2024 14:24
Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did another round of comments. Once we complete those, I will as a final step take a higher look from above, probably run the docs and see how they read now.
As a preparation for that, what do you say about what I asked here #2375 (review) ? What is your view on the current structure, how do you feel about it?

@infomiho infomiho requested a review from Martinsos December 16, 2024 14:56
Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Responded again.

@infomiho infomiho requested a review from Martinsos December 17, 2024 16:50
@infomiho infomiho merged commit 83e7333 into miho-deployment-docs Dec 19, 2024
@infomiho infomiho deleted the miho-deployment-docs-env-vars branch December 19, 2024 10:33
infomiho added a commit that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants