Skip to content

Add a task for switching between environments#363

Open
lipskis wants to merge 1 commit intomainfrom
environment-switching
Open

Add a task for switching between environments#363
lipskis wants to merge 1 commit intomainfrom
environment-switching

Conversation

@lipskis
Copy link
Copy Markdown
Contributor

@lipskis lipskis commented Mar 31, 2026

This is what I use to quickly switch between different environments. I run rake env:local or rake env:staging, or rake env:prod and that's it.

It's basically just 3 appsignal_key_[env].env files, and an .appsignal_environment file that tracks which env file is used in appsignal_key.env. A command like rake env:local copies appsignal_key_local.env to appsignal_key.env, which then gets used in all test-setups.

I haven't made this work with rake global:set_push_api_key, but I will do that if this is something that we actually want to add.

Add `env:[name_of_env]` rake tasks that allow switching between local,
staging and production environments. Display environment when running
`rake app:up`.
@lipskis lipskis self-assigned this Mar 31, 2026
@lipskis lipskis requested review from tombruijn and unflxw March 31, 2026 10:31
@backlog-helper
Copy link
Copy Markdown

backlog-helper Bot commented Mar 31, 2026

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@lipskis lipskis changed the title Add task for switching between environments Add a task for switching between environments Mar 31, 2026
@lipskis lipskis force-pushed the environment-switching branch from d2593cc to 74441c5 Compare March 31, 2026 10:33
@unflxw
Copy link
Copy Markdown
Contributor

unflxw commented Mar 31, 2026

CI failure unrelated, fixed in #364.

Copy link
Copy Markdown
Contributor

@unflxw unflxw left a comment

Choose a reason for hiding this comment

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

Something like this would be nice, yes! Here are some non-binding thoughts:

Wondering if we could have it print the whole contents of appsignal_key.env on boot, and then we don't need to keep around .appsignal_environment for that purpose (which is a piece of state that may fall out of sync with the state it's supposed to correlate to) -- the file could have a # ENV: prod comment added at the top of it when you switch.

I think giving the implementation another spin could work. Replacing global:set_push_api_key or getting rid of it entirely seems necessary, yes.

I'd suggest not having aliases that don't match the required file names. If the file has to be named _local.env, don't let me use env:development, that only makes it more confusing when I name the file _development.env and it doesn't work.

Consider replacing the three tasks with a parameter? Something like rake env=prod env:switch replacing all three, for example. That way there's no mandatory set of allowed names.

@tombruijn tombruijn removed their request for review April 1, 2026 14:13
@backlog-helper

This comment has been minimized.

12 similar comments
@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@tombruijn tombruijn added the chore A small task that takes a day or two at the most. label Apr 20, 2026
@backlog-helper

This comment has been minimized.

1 similar comment
@backlog-helper
Copy link
Copy Markdown


This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore A small task that takes a day or two at the most.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants