.data Security Question

Hi, all! This is my first post on the Glitch forums, so if I screwed something up, please let me know.

I have a simple question: can I reliably use a .data folder to store sensitive configuration files? I’m only asking this because I haven’t been able to get .env to reliably work.

2 Likes

Yes!

What happened? We can probably help.

4 Likes

If you think it is a code issue, look below. If it is not that, feel free to ask!
Step 1: refresh your application. Run the refresh command in your project terminal.
Step 2: Use one of the usage examples to get the env var:
JavaScript:

var env_var = process.env.ENV_VAR_YOU_WANT_TO_GET

Python (not really good at it, sorry)

import os
os.getenv('ENV_VAR_YOU_WANT_TO_GET')

PHP:

<?php 
$ENV_VAR = $_ENV["ENV_VAR_YOU_WANT_TO_GET"]
?>

@beckettnormington just so you know you can only access env vars with node.js and sending a GET request to a slug that begins in a . (we are using .data) will return Forbidden.

You would have to get a package to make this work, but this is the idea.

1 Like

not always, the lamp-poc project doesn’t hide all dot directories. Make sure to keep that in mind for security

do you maybe have spaces around the = signs in .env?

what was the slug for logs in apache (lamp-poc) that @RiversideRocks found the bug?

/.apache2/log/access.log

And I wouldn’t really call it a slug, its a file.

Hey, I just wanna say, the Solution button is for marking which answer solved your problem which lets other people with the same problem find the answer easily without having to search through a bunch of conversation. It looks like you didn’t find your answer yet and people might think you already have and won’t attempt to help you.

3 Likes

No, I do not.

Oh, oops. My apologies.

1 Like

Thanks for the answer; it solved my issue with the .env variables.

1 Like

@aboutDavid, we are quite obviously trying to help him:

.data Security Question - #6 by javaarchive

Other people? Like you don’t always know the answer so other people.

I linked javaarchives post.

But where in this post did you link it?

Also, I say things for the future as well, Not everyone knows how to use the forum and @beckettnormington is new to the forums so I explained the solution button?

1 Like