juicefs icon indicating copy to clipboard operation
juicefs copied to clipboard

read meta-url from variable

Open sedlund opened this issue 1 year ago • 4 comments

What would you like to be added:

juicefs cli should read meta-url from an environment variable by if set. I suggest JFS_URL

If the meta-url is specified on the command line, it should take precedence.

Why is this needed:

it makes the cli nicer to use not having to specify the url each time it is required.

sedlund avatar Oct 12 '24 08:10 sedlund

Agree, but it would make more sense to be META_URL, as META_PASSWORD already exists.

solracsf avatar Oct 13 '24 06:10 solracsf

agree, would like to see all juicefs variables prefixed as is common elsewhere -- JFS_ or JUICEFS_

sedlund avatar Oct 13 '24 07:10 sedlund

So if I run juicefs mount xxx, xxx would be interpreted as the mount point while the URL is read from the environment variable? What if I only specify the URL and miss the mount point?

suzaku avatar Oct 18 '24 08:10 suzaku

So if I run juicefs mount xxx, xxx would be interpreted as the mount point while the URL is read from the environment variable?

Yes. If $JUICEFS_META_URL is set, it fits a validation schema and xxx is a directory.

What if I only specify the URL and miss the mount point?

Following the same steps above, the URL fits validation URL schema then it will error on no mount point specified.

sedlund avatar Oct 18 '24 09:10 sedlund

It's better to keep the command arguments consistent.

The sync command read the meta-url from environment variable, which use the volume name as the name, for example,

myfs=redis://localhost/  juicefs sync jfs://myfs/prefix s3://mybucket/prefix

It support multiple volumes in the same time, maybe we can do the same thing here:

myjfs=redis://localhost/  juicefs mount myjfs /mnt

But, we use redis:// as the default schema, and the myjfs will be treated as hostname rather than a variable name.

davies avatar Oct 23 '24 08:10 davies

There is not much we can do without breaking existing command options, close it for now.

davies avatar Mar 03 '25 07:03 davies