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

Docker Compatibility #45

Closed
wants to merge 20 commits into from
Closed

Conversation

Helvio88
Copy link
Contributor

@Helvio88 Helvio88 commented Sep 9, 2023

This set of commits enables TinShop to run on Docker without the need of a config.yaml file mapping.
I am running as a container and without a configuration file. All settings were transported successfully.

According to Viper docs, ENV vars naturally supersede a config file. I mapped all the missing configs on viper.

@Helvio88
Copy link
Contributor Author

Helvio88 commented Sep 9, 2023

This should address #44 for the most part.

Copy link
Owner

@DblK DblK left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I added some comment, feel free to comments.
Also could you rebase from master please.

And I guess you were talking about closing #44

README.md Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
config/config.go Show resolved Hide resolved
viper.SetTypeByDefaultValue(true) // Allows []string to be parsed from Env Vars

viper.SetDefault("host", "tinshop.example.com")
viper.SetDefault("protocol", "http")
Copy link
Owner

Choose a reason for hiding this comment

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

Is function ComputeDefaultValues, http is assumed if no protocol, so default value is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is a matter of preference, so I will make my case but accept your decision.
viper needs a default set (could be nil) in order to assign ENV vars to configuration keys.
For the sake of standardization, I believe this could stay here, and the ComputeDefaultValues should test for invalid values and force them to be the default, instead of being the default section “setter”. This way, all the default values are in one place. What are your thoughts?

@@ -32,6 +32,52 @@ To proper use this software, here is the checklist:

Now simply run it and add a shop inside tinfoil with the address setup in `config` (or `http://localIp:3000` if not specified).

# 🐋 Docker
Copy link
Owner

Choose a reason for hiding this comment

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

I would add this section after Dev or build from source and maybe add a sentence with link and this end of 🎮 Use to talk about how to use it with docker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the section below Dev or build from source but I don't understand the 🎮 Use part.

@DblK DblK linked an issue Sep 9, 2023 that may be closed by this pull request
@DblK DblK self-assigned this Sep 9, 2023
@Helvio88
Copy link
Contributor Author

Helvio88 commented Sep 9, 2023

Please see #46 - PR against master

@Helvio88 Helvio88 closed this Sep 9, 2023
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

Successfully merging this pull request may close these issues.

stats.db cannot work with Docker
2 participants