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

Idea: Dynamic deploy configurations #11

Open
eimermusic opened this issue Jan 23, 2018 · 3 comments
Open

Idea: Dynamic deploy configurations #11

eimermusic opened this issue Jan 23, 2018 · 3 comments

Comments

@eimermusic
Copy link
Contributor

Hi @nickfan
I had an idea... not fully baked and ready for any PR.

Like the question in #7 , I too want to separate staging and production deploys in a more dynamic way than a symlink. I would, for example, want to default to a "safe" deploy target. Let me know if any of the below would be interesting to make a bit nicer and pull back into the project.

Here is where I am so far:
I am modifying the @include line at the top of Envoy.blade.php to allow for a variable filename.

@include('envoy.'.env('CONFIG', 'config').'.php');

I can then call envoy and prepend a temporary env variable called CONFIG.

CONFIG=production envoy run deploy

This gets me a default running of the default config file and allows for additional files to be chosen using this env var. I am not super happy about the resulting filenames. But I preferred to retain compatibility with the default filename without complicating the change. envoy.production.php is not a great filename but I can live with it.

I initially wanted an Envoy argument to specify the config file or "deploy type". E.G:

envoy run deploy --config=production

I did not get that working. I guess that Envoy is not fully bootstrapped at the time of this include, which is done by Blade.

I also thought about possibly doing it in the config file. E.g. including additional files if the variable is found... this could be interesting in allowing part of the config to be global and other parts to be specific to the deployment type.

@nickfan
Copy link
Owner

nickfan commented Mar 16, 2018

env('CONFIG', 'config')

require function define or vendor loaded (composer install dotenv) first.

@xalunda
Copy link

xalunda commented Jan 8, 2020

Hi there,

I'm very late for this, but I've been trying to implement your awesome envoy file to my project.
I also needed different config files, so here is what I did and works for me.

  • Remove @include('envoy.config.php'); ate the top of the file
  • At the beginning of @setup I wrote this:
@setup
    if ( isset($config) && file_exists("envoy.config.$config.php") ){
        include("envoy.config.$config.php");
    }
    else{
        include("envoy.config.php");
    }

    ...

@endsetup

I can now use --config=something to load envoy.config.something.php

Hope this helps :)

@nickfan
Copy link
Owner

nickfan commented Jan 9, 2020

image
i just use sym links.
to change just:

ln -nfs envoy.config.development.php envoy.config.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants