• jjjalljs@ttrpg.network
    link
    fedilink
    arrow-up
    69
    arrow-down
    1
    ·
    12 days ago

    Is the backend Python and the frontend JavaScript? Because then that would happen and just be normal, because Boolean true is True in python.

      • PotatoesFall@discuss.tchncs.de
        link
        fedilink
        arrow-up
        25
        ·
        12 days ago

        Yep they should use a config file format like JSON or TOML or YAML or what have you, and then decode that into python objects. Using an actual programming language for config is dumb as hell IMO. (inb4 pissed off suckless fans)

      • jjjalljs@ttrpg.network
        link
        fedilink
        arrow-up
        5
        ·
        12 days ago

        Depends on how it’s set up. If the setting is going into the env it’s a string, so I’d expect some sort of

        if os.getenv("this_variable", "false").lower() == "true":   # or maybe "in true, yes, on, 1" if you want to be weird like yaml
          this_variable = True
        else:
          this_variable = False
        

        Except maybe a little more elegant and not typed on my phone.

        But if the instructions are telling the user to edit the settings directly, like where I wrote this_variable=True, they’d need to case it correctly there.

        • Fushuan [he/him]@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          12 days ago

          Fyi, using a condition to assign a boolean is equivalent to assigning the condition itself. No need for the IF.

          • jjjalljs@ttrpg.network
            link
            fedilink
            arrow-up
            3
            ·
            12 days ago

            true, though sometimes i find the more verbose style easier to read, and more maintainable (eg: you want to do something else in the block, you can just add a line instead of changing your ternary / etc). Small things