masonite icon indicating copy to clipboard operation
masonite copied to clipboard

Specify which environment to load in tinker command

Open girardinsamuel opened this issue 3 years ago • 2 comments

  • [ ] Would be great to be able to specify which environment to use when running python craft tinker maybe with
python craft tinker --env production

default would be development

  • [x] It would be great to display the current environment at tinker start: Environment: production.

girardinsamuel avatar Oct 04 '21 00:10 girardinsamuel

Or is it useless as we can do something like APP_ENV=production && python craft tinker ?

This is actually a feature from Django, in every commands you can override current env I find this really handy, and could be done in a command mixin:

class CanOverrideEnvironment:
    # add --env option which set APP_ENV and LoadEnvironment() for it
class TinkerCommand(Command, CanOverrideEnvironment):
    #...

girardinsamuel avatar Oct 06 '21 13:10 girardinsamuel

the --environment flag is nice if we can set environment variables on the fly like that. Maybe keep this as a p4 issue and come back to it on request. In the meantime, the second option should work where you set the environments variables before calling the tinker command

josephmancuso avatar Oct 06 '21 17:10 josephmancuso