I am trying to access my secrets through Studio, I am aware that I can just turn on Team Create and the secrets will work. I want to use the secrets that I put inside Game Settings Secrets. I am not sure what is the format though.
Things that have shown signs of working is putting the secret in this format:
The problem with this is that when I am using the GetSecret method and about to make a request, I get the error that the secret can not be used for the domain, and this makes sense because I never specified it.
Sometimes your secrets can be restricted to particular domains or services for security reasons. So it may not be an error on your end since as long as you are using :GetSecret with the correct name there isn’t any issue with the environment
I understand that, but if I wanted to test in Roblox Studio, I would have to either do Team Test every time or expose the Secret directly inside the code, and if I forget then it might be game over.
for the domain value you can just do wildcard “*” for the simplest unrestricted usage of the secret.
a related question: i am a solo dev so i have not yet had a chance to test this, but do these Game Settings > Security Secrets get saved for other devs associated with the game?
if all devs can see these Secrets and granular access to the secrets is a requirement, i guess we we can consider using a local .env file and write a module to parse it using the command bar.
-- FileLoader
local StudioService = game:GetService("StudioService")
local function loadFile()
local selected = StudioService:PromptImportFile({"txt"})
if selected then
print(selected:GetBinaryContents()) -- update logic here to parse into local secrets
else
print("No file selected.")
end
end
return loadFile
Then wrap your HttpService:GetSecret(key) calls in a pcall, and if it fails use the local value if provided, otherwise default to a idempotent mock.