bluepema schemas btw are generally closed, this will require having the ability to specify an open pema schema, because process.env will otherwise always kill it
phalethpema reminds me I should go drink my lemonade
phalethAppFacade sounds very strange
blueoh nvm, pema schemas are open, I should change that
blueit's not stranger than a RequestFacade :P
bluehm, well, 'open' is a weird way to put. it does ignore unknown values, but doesn't through on them
bluethrow*
bluewell the idea of a Facade is that you don't expose everything
blueso a primate RequestFacade doesn't give everything that a WHATWG Request has. it has a few things extra, and hides some ugly impl details
bluean AppFacade is the same. you don't want/need the entire App object
blueit's jst an abstraction. but calling it just Request or App is confusing. especially in the case of Request where the type is already held by WHATWG Request and we'd be shadowing and confusing people
blueI need to embed the markdown file's data within the svelte component
blueand I need to do it dynamically, based on the path
phalethso it's some sort of a root class
blueyeah. and in 0.37 it will get a useful env object
blueso you'll be able to do app.env.STRIPE_SECRET and you get automatic typing, as a string
blueor app.env.PORT and it comes as a number
bluethis will be based on the schema you provide in app/config.ts
phalethok, then I guess env should be a thing of it's own as not in all cases the whole env should be queried at the root of the app
bluethe schema will do a runtime check so the app won't start with a STRIPE_SECRET
phalethI mean some frameworks do that, but it can bring in bloat
blueI actually debloated this, in @rcompat/env 0.14 I used dotenv
bluein 0.15 I just wrote a parse myself, it's like 20 lines
blueparser*
bluethere's not a lot of bloat going on here
bluethe two key advantages to this proposal is: hard failure when you didn't configure a required env key, and strong typing for those keys, if you need it
phalethby bloat I mean a lot of env vars that can be in the current shell or whatever
blueI think the former is important, becaus you could get silent weird failures when some env vars aren't configured. the latter one is aesthetics
blueyes but these get loaded anyway by node into process.env
blueyou can't really avoid that
phalethok, well, if process.env just works, then I'd not bother with any of that
blueit does but you have .env files + as I said, runtime validation
blueapp#env just gives you a nice centralised way to access those env vars in a controlled way, otherwise env vars are too loose
blueof course as a user you can completely ignore it and go with process.env
bluebut I don't see a lot of advantage
blueso one of the things that annoyed me the most deploying nevet (looking at you, dreamreal) is that I had no idea what's up with the env vars. some of them weren't documented. and this stupid framework just starts up without checking if the envs are set, that's terrible
dreamrealWhich ones aren't documented? The user docs and deployment docs should cover every one of them. If there's one that isn't described, it should DEFINITELY be filed as a bug, because that's the author screwing up
phalethyeah, but it's dev's responsibility to warn or error when some input is missing
phalethand I think that obscure error was because of some jdbc whatever thingy
dreamrealand blue: when you have content for primate.run, let me know - I want to write it up on bytecode.news (the site's coming together)
phalethwhich is a library itself and if the library is bad well then everything with that library is bad
dreamrealwhat?
phaleththat was meant for blue, and I agree that there should be as much compile time checking as possible
phalethbut env vars are used for all sorts of crap, not just configs
dreamrealone of the things I'm gonna have to figure out for nevet is how to provide access to more LLMs: right now it's anthropic and that's it, you can't "configure openai and not anthropic" and get openai, and you can't combine them
bluephaleth: the BEST way is self-documenting code. nothing beats: `host: p.string.url({ protocol: "jdbc" })`
bluethis is the angle provided by AppFacade#env
blueI'm so tired of writing @rcompat/*, I wanna finish up flog so I can start using std:
bluetbht, I have no idea how I'd keep primate compatible with node/deno/bun then :(
bluefor node you can rewrite imports, but it's black voodoo magic and doesn't work deno/bun
bluewould be cool if the runtimes supported rewrite rules in package.json
bluebut I can also see how that leads to absolute catastrophes
blue@rcompat/* will always stay aligned with std:*, so if I could rewrite std: onto @rcompat/* for non-flog runtimes, that'd be supreme. unfortunately I'm not sure that's possible
phalethif somebody uses primate to develop their apps then they will use whatever feature the runtime offers and if clanker tells the use this shiny bun feature, they will use that bun specific feature and think it's very convenient, clueless about rcompat being already there
blueya, but that's not the point. I'd like to use std: *myself* in primate code
blueand I can't do that as-is since it wouldn't run on any runtime
bluefor that, the runtime needs to know what "std:" is. and no runtime supports that atm
phaleththat's the burden of being a library author
bluefor node, you can register loads so I could simply map "std:*" to "@rcompat/*
blueloaders*
bluewhy is the js landscape such unregulated dumpster fire
bluehaving a sane std is like the absolute basics in every language out there