-
Notifications
You must be signed in to change notification settings - Fork 25
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
Docker support #34
base: main
Are you sure you want to change the base?
Docker support #34
Conversation
@@ -0,0 +1,52 @@ | |||
<?php | |||
|
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.
Isn't this self-defeating to make the values globally available twice?
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.
This is only easy option.
You can't set static properties dynamically with function call so I have to first save them into constants.
But it may also work with normal variables instead of constants.
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.
This is only easy option.
I think putting the argument in the connection utility fits better with a heroku + docker (12-factor) deployment.
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.
I think putting the argument in the connection utility fits better with a heroku + docker (12-factor) deployment.
Can you explain this a bit more?
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.
So instead of having config be the source for all things, you could instead build an interface and have multiple implementations that fulfil that interface to provide details.
A Lighter weight option that does similar would be using null coalesce operator, leaving the config as null, and Config::$value ?? ENV['ENV_VAR1'] ?? ENV['ENV_VAR2'];
http://sandbox.onlinephpfunctions.com/code/22d382de6f0128a63d11ba37b79a4c7d3faad57a is a trivial example
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 is now setting properties directly from env vars. It doesn't need null coalesce operator, because env vars need to be set anyway.
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.
I think there has been confusion about my meaning.
Also blank string is not really the best option.
null specifically says "unknown"
I've made a PR which I think explains what I think is a better approach to ENV based configuration. It was what I was trying to explain to you. Basically there should be no need for |
I've added basic support for Docker. It is part of the fix for #27. That issue should still be opened because it is still not completed.
It is now possible to run the website with
docker-compose up
. It contains several containers for PHP, Ruby, SQL and Redis.After cloning the repo, users should copy
lib/config.docker.php
tolib/config.php
(and not edit it). That file loads config from environment variables.Then, they should copy
.env.sample
to.env
and provide configuration.They can then start all containers with
docker-compose up
.This has some problems.
The database is empty. Even if table schema is added at first run, tables will be empty. And this is a problem because the
client_id
would not be registered. There should be some admin website or console command to add clients.Also, documentation is not finished. It needs to be finished after all other problems are fixed.
And all functionality needs to be tested because I didn't have time to do this completely.