Skip to content

sqlpage.environment_variable should return null, not throw an error, when the variable does not exist #746

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

Closed
lovasoa opened this issue Dec 20, 2024 Discussed in #745 · 0 comments

Comments

@lovasoa
Copy link
Collaborator

lovasoa commented Dec 20, 2024

Discussed in #745

Originally posted by Floflobel December 20, 2024
Hello,

Doc: https://sql-page.com/functions.sql?function=environment_variable#function

I'd like your opinion before I look at the code.
I would like to create parameters for my application that I will deploy via ansible. The goal is to then call this parameter in the SQLPage code.

My idea was to put an “env_vars” file in my SQLPage folder next to the “.sql” files and modify my systemd that runs SQLPage to add this:

EnvironmentFile=-/srv/%i/env_vars

I then tried to call my environment variable and everything works perfectly, but if it doesn't exist I have no way (or I don't know it yet) in SQL to ignore the error.

Would it be a good idea to modify the code so that it returns “NULL” when the variable doesn't exist?

Thank you,

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

No branches or pull requests

1 participant