#Nice! If you wanted, I think you could

1 messages · Page 1 of 1 (latest)

prisma imp
#

When you get a chance could you help me with this, I tried to change the code to use the CacheVolume type but its not happy with my default or word argument

    // Optional cache volume; this is useful if you work with multiple projects
    // or have node_dependencies that are rapidly changing to avoid issues with
    // npm having failures.
    // +optional
    // +default="node-docusaurus-docs"
    volume *CacheVolume,
Error: query module objects: returned error 400 Bad Request: failed to get schema for module "docusaurus": failed to install constructor: failed to get field spec: failed to decode default value for arg "volume": decode "CacheVolume" ID: failed to decode base64: illegal base64 data at input byte 4
weak compass
#

oh yeah that's probably not possible 😇

#

i think we've had a similar desire for a default Container arg, by passing an image ref

#

pretty sure that doesn't work either right?

#

is it the worst thing in the world to default to not having a cache volume? (honest question, not sure of the negative impact)

#

i wonder if caching-by-default is one of those sneaky footguns

#

depending on the scenario anyway

prisma imp
#

the intent here is to cache things by default without anyone thinking about it, but in the case where they run into issues have a chance to update the volume name instead of having to disable the cache completely.

weak compass
#

ah is this to dodge a horrendously slow npm install that would happen on each run

prisma imp
#

yeah exactly

weak compass
#

ok makes sense

prisma imp
#

it seems to work fine with string -- but @mild karma made the same comment about why I wasnt using CacheVolume directly, not sure if he had something else in mind here too.

weak compass
#

i think ideally we would have these defaults work in the same way that parsing CLI flags works, but they're two separate systems at the moment

#

i think his comment was just the same as mine - it's nicer from an API perspective to pass around objects, but the downside here is it doesn't support a default value

prisma imp
#

Could I make a default value programatically or does that just make things worse? lol

Im thinking of the old way we did things.

weak compass
#

yeah, you could just leave it +optional and do a volume ||= cacheVolume("x") type pattern in code

#

might even be slightly advantageous since that'll hide the default name, letting you change it if you need to for whatever reason (backwards-incompatible change with old cache)

#

so if someone wants to access it externally, they can just explicitly pass in their own name and use it in both places

weak compass