How to access application credentials from stimulus controller?

Dear community,

Is it possible to access application credentials (credentials.yml.enc) from stimulus controller? The easiest way that I know is passing directly from the view as argument but that is not secure, for example something like data-property-api-key="<%= Rails.application.credentials.google[:places_api_key] %>"

Thanks.

2 Likes