Skip to content

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

Closed
@lovasoa

Description

@lovasoa

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions