Multiple secret values?

i’m making something and I want multiple values (specifically usernames that are allowed into the project) in a secret. I tried the edit as json thing and I got this
image
i can’t save. Help?

I want to clarify that I just want secret values I don’t need to use secrets (env vars) but it would be preferable. I wanted to use the list of usernames like a variable and the Repl checks the username but I can’t

3 Likes

You could make it a string ("[\"abc\",\"def\"]"), and then JSONify it.

4 Likes

good idea, marked

wait using json.parse right

@fp ^^

3 Likes

You know those don’t work, right @doxr?

Yes, how else would you do it?

1 Like

I do but I didn’t know if I should ping you but I did want you to see it so I did what I like to call semipinging you ¯\_(ツ)_/¯

It won’t send a message but if you see it then you know it’s a semiping and you should respond

what if I put it in quotes and removed the first and last quote and then javascript turns it into an actual value instead of a string somehow (don’t answer that question)

1 Like

So… Parse it yourself. lol

¯\_(ツ)_/¯

3 Likes

@Firepup650 Sorry for the unmark because it doesn’t work.

 "allowedUsers": "{'allowedUsers': ['doxr', 'username1'}"

JSON.parse gives this (console logged it)

SyntaxError: Unexpected token ' in JSON at position 1

And you can’t switch them around (" and '), because Replit’s json editor thing doesn’t like it

Edit: nvm I fixed it. You have to do it with the ui for anyone wondering.

3 Likes

You missed a ] hehe

1 Like

Thats how JSON work lol

2 Likes

yeah ik :confused:

2 Likes

You have to escape the quotes.

"allowedUsers": "{\"allowedUsers\": [\"doxr\", \"username1\"}"
3 Likes

I realized that and edited my original suggestion to account for that.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.