-
-
Notifications
You must be signed in to change notification settings - Fork 430
Setup generator #804
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
Setup generator #804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I dig it, but I do think the token should just be an argument since there's never a case where it would be run without it, right?
Also, not important for a first pass, but it might be nice to have an option to automatically run the migrations as well after generating them. It doesn't need to by default, but it reduces the amount of commands to type/copy/paste if we can have a sample command that includes the option and runs the migrations by default. (Although that does blur the line with whether this is generating or installing, so it may be a step too far.)
end | ||
|
||
def configure_with_credentials | ||
return unless exists?("config/credentials.yml.enc") && (ENV["RAILS_MASTER_KEY"] || exists?("config/master.key")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's common enough that the credentials can be split over individual environment files as well since that can help reduce conflicts when merging the encrypted files. So is it worth checking for production.yml.enc
as well?
That question then leads to whether we'd want to proactively help set up multiple environments. So should the keys maybe be specified by environment? This all quickly complicates things, though.
I think I'd make the token an argument and then add an option for --environment
that accepts a string and has --env
(and -e
if no conflicts) as aliases. Whether it should default to prod or dev is less immediately obvious to me at the moment, though. Dev gets things up and running faster, but production is more of the end game. I think I lean towards development.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good call. I was only thinking about development on this first pass, but I'd like to iterate on this and add multiple environment support.
Open source users will run it without the arg, but I guess it could be optional. You and I also talked about allowing signup through the generator, like |
I'm totally down with punting, I was just trying to minimize the churn for the generator arguments/options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Love the reduction in friction. Does it also run the migrations after they are generated?
It does not. Do other generators often run migrations? We definitely could do it, just not sure I've ever seen another library do that. In all honesty, the other reason it doesn't is because I couldn't figure out a way to get the tests to still run with it. Adding |
flipper:active_record
if adapter is installed--token xyz
adds to dotenv if it exists--token xyz
adds to Rails credentials if it it's used