Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for key_file fstab option #182

Merged
merged 3 commits into from
Aug 15, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/mounting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Console:

GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json gcsfuse [...]

On OS X and Linux you can also use fstab option in `/etc/fstab` system file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you touch up the wording here a bit (and drop the references to OS X and Linux, since these are the only systems we support)? Probably:

When mounting with an fstab entry, you can use the key_file option. For example:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, good point. My comment was based on the existing last note of this file though:

On both OS X and Linux, you can also add entries to your /etc/fstab file like the following:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah you're right. In that case, could you actually move this information to the fstab section of this file? So it says something like

If you need to specify custom credentials in your fstab, use the key_file=/path/to/file option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing.


my-bucket /mount/point gcsfuse rw,noauto,user,key_file=/path/to/key.json

[gce]: https://cloud.google.com/compute/
[gce-service-accounts]: https://cloud.google.com/compute/docs/authentication
[gcloud tool]: https://cloud.google.com/sdk/gcloud/
Expand Down Expand Up @@ -97,6 +101,7 @@ with dashes instead of underscores:
* `implicit_dirs`
* `dir_mode`
* `file_mode`
* `key_file`

On both OS X and Linux, you can also add entries to your `/etc/fstab` file like
the following:
Expand Down
8 changes: 8 additions & 0 deletions tools/mount_gcsfuse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ func makeGcsfuseArgs(
"--"+strings.Replace(name, "_", "-", -1),
)

// Special case: support mount-like formatting for gcsfuse string flags.
case "key_file":
args = append(
args,
"--"+strings.Replace(name, "_", "-", -1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run gofmt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did. Double-checked that now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies, I had misjudged what gofmt would do here. Thanks!

value,
)

// Special case: support mount-like formatting for gcsfuse string flags.
case "dir_mode", "file_mode":
args = append(
Expand Down