APPENDIX BDeploying Applications

In this appendix, we are going to discuss strategies to manage the configuration, distribution, and deployment of your applications. The landscape is vast, and the specific strategies that you follow are usually determined by the infrastructure into which you are deploying your applications. By no means do I aim to be exhaustive; rather, I only seek to provide you with generic guidelines.

Managing Configuration

We have been using command-line flags and environment variables to specify various configuration data in our applications. Configuration data are those pieces of information that your application needs to perform a functionality. However, the user shouldn't need to specify them. For example, in Appendix A, “Making Your Applications Observable,” we used flags to specify the address of the metrics server. However, the address of the metrics server will not vary with the user's input, such as the package name or version to upload. In fact, in most cases, your application's user is happy to not be required to specify it, unless it is to specifically override it.

Similarly, we have used environment variables to specify both nonsensitive and sensitive configuration data in our applications. For example, the database password, covered in Chapter 11, “Working with Data Stores,” was specified as an environment variable. Command-line flags, as well as environment variables, are simple to understand and require no additional libraries for support ...

Get Practical Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.