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 multiple profiles via [profiles] configuration #546

Merged
merged 47 commits into from
Apr 5, 2022

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Mar 24, 2022

Fixes #142

This PR introduces breaking changes, which will result in a new major version release (v2.0.0).

This PR replaces the fastly configure command with:

  • fastly config
  • fastly profile

NOTE: This PR also introduces a new global --profile flag for temporarily switching the user's profile for the duration of the command execution.

Migrating existing user data

The configuration file was previously defined as:

[user]
  email = ""
  token = ""

The data in these fields will be auto-migrated to a generic 'user' profile:

[profile]

  [profile.user]
    default = true
    email = "<REDACTED>"
    token = "<REDACTED>"

Screenshots of new commands

Screenshot 2022-04-04 at 15 26 02

Screenshot 2022-04-04 at 15 28 11

Screenshots of usage

The following screenshots do not capture all scenarios or use cases, for that refer to the code and test suite.

List profiles so we can see there are none defined yet...

Screenshot 2022-04-04 at 15 29 14

Create a profile for the first time, it will automatically be set to being the 'default' profile...

Screenshot 2022-04-04 at 15 29 52

Create a new profile, and set it to be the default...

Screenshot 2022-04-04 at 15 30 28

List profiles so we can be sure the new 'personal' profile created has been set to be the default...

Screenshot 2022-04-04 at 15 31

Switching profiles, and then checking the profile was switched...

Screenshot 2022-04-04 at 15 34 36

Delete the profile that is currently the 'default', notice the warning provided...

Screenshot 2022-04-04 at 15 39 22

Update a profile but give an unknown profile name...

Screenshot 2022-04-04 at 15 40 36

Update a profile, and also set it to be the default...

Screenshot 2022-04-04 at 15 41 23

Use the global --profile flag to temporarily switch profiles, but notice we provide an unrecognised profile name...

Screenshot 2022-04-04 at 15 43 50

Copy link
Collaborator Author

@Integralist Integralist left a comment

Choose a reason for hiding this comment

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

@doramatadora There are a lot of scenarios to cover and so I've tried to use screenshots in the PR description to help visualise the features this PR is introducing. Otherwise hopefully the following comments help to digest the relevant code changes.

.gitignore Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
pkg/app/commands.go Outdated Show resolved Hide resolved
pkg/app/run.go Show resolved Hide resolved
pkg/app/run.go Outdated Show resolved Hide resolved
pkg/config/data.go Show resolved Hide resolved
pkg/profile/profile.go Show resolved Hide resolved
@Integralist Integralist marked this pull request as draft April 1, 2022 15:35
@Integralist Integralist marked this pull request as ready for review April 4, 2022 14:45
Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

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

This is not a code review but I have tested the functionality and it works as described. Really excited to see this, thanks for the awesome work @Integralist! 🎉

Copy link
Contributor

@doramatadora doramatadora left a comment

Choose a reason for hiding this comment

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

This is very exciting to see ❤️ 🚀

pkg/commands/compute/init.go Show resolved Hide resolved
pkg/commands/compute/language_other.go Outdated Show resolved Hide resolved
pkg/commands/profile/create.go Outdated Show resolved Hide resolved
@Integralist Integralist merged commit ec67f8a into main Apr 5, 2022
@Integralist Integralist deleted the integralist/profiles branch April 5, 2022 13:29
@Integralist Integralist added the enhancement New feature or request label Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple switchable profiles
3 participants