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

[FEATURE] Improve storage of .asyncapi-analytics config file #1427

Closed
2 tasks done
peter-rr opened this issue May 15, 2024 · 7 comments
Closed
2 tasks done

[FEATURE] Improve storage of .asyncapi-analytics config file #1427

peter-rr opened this issue May 15, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@peter-rr
Copy link
Member

peter-rr commented May 15, 2024

Why do we need this improvement?

Main ideas taken from @asyncapi/developer_experience_wg slack discussion:
cc @smoya @fmvilas

  1. We are handling the same analytics config file for integration tests and source code, which might lead to potential conflicts.

  2. Also we are storing that analytics config file at home directory, which is not a recommended practice.

How will this change help?

  1. We can avoid potential conflicts by not mixing testing data with real user data.

  2. Not polluting the user's home directory.

Screenshots

No response

How could it be implemented/designed?

  1. Handling different config files for testing and source code.

  2. The analytics config file should have a configurable path, and also be interchangeable between the different apps (like CLI, Studio), so we can know when the user is jumping from one app to another.

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

No, someone else can work on it.

@peter-rr peter-rr added the enhancement New feature or request label May 15, 2024
@github-project-automation github-project-automation bot moved this to Backlog in CLI - Kanban May 15, 2024
@peter-rr
Copy link
Member Author

@Amzani How can I add this issue to the DX working group's Kanban?

@Amzani
Copy link
Collaborator

Amzani commented May 16, 2024

@peter-rr it's automatically added

@Amzani
Copy link
Collaborator

Amzani commented May 17, 2024

/gfi dx

@asyncapi-bot
Copy link
Contributor

Hey @Amzani, your message doesn't follow the requirements, you can try /help.

@peter-rr
Copy link
Member Author

@fmvilas @smoya I'm trying to find out a good solution for what we talked about here, but I'm kind of stuck right now 🤔

Regarding the usage of a configurable path for the analytics config file, should we interact with the user to get the file path desired and then use the value passed as a parameter? Could you provide any suggestion or example about this topic? Thanks, folks 😄

@smoya
Copy link
Member

smoya commented May 27, 2024

@fmvilas @smoya I'm trying to find out a good solution for what we talked about here, but I'm kind of stuck right now 🤔

Regarding the usage of a configurable path for the analytics config file, should we interact with the user to get the file path desired and then use the value passed as a parameter? Could you provide any suggestion or example about this topic? Thanks, folks 😄

Let the path for the config file to be defined by an environment variable, with a default value in case is missing (the home directory is the default value).
Despite the env var name (up to you), line https://github.com/asyncapi/cli/blob/master/src/base.ts#L101 could be changed to:

const analyticsConfigFile = process.env.ASYNCAPI_METRICS_CONFIG_PATH || join(homedir(), '.asyncapi-analytics'); 

Then, users could change the path by just setting such an env var. i.e.ASYNCAPI_METRICS_CONFIG_PATH=/tmp/hello/.asyncapi-analytics

Regarding tests, you can do the same: set up that env var to a known and controlled config file path instead of using the one located in ~home.
However, as I recommended in the Slack thread you shared, the best way to work with tests is to create an interface for the storage of the config, and swap it in tests (from in file, to in memory).

@peter-rr peter-rr moved this from Backlog to In progress in CLI - Kanban Jun 3, 2024
@peter-rr peter-rr moved this from In progress to In review in CLI - Kanban Jun 3, 2024
@peter-rr peter-rr moved this from In review to Done in CLI - Kanban Jun 6, 2024
@peter-rr
Copy link
Member Author

peter-rr commented Jun 6, 2024

@Amzani We can proceed to close this issue since #1451 and #1452 are already merged 🚀

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
Archived in project
Development

No branches or pull requests

5 participants