[PR #311] [MERGED] Add Support for Loading Environment Variables from .env Files #385

Closed
opened 2026-02-28 00:41:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Telmate/proxmox-api-go/pull/311
Author: @JamborJan
Created: 2/6/2024
Status: Merged
Merged: 2/15/2024
Merged by: @mleone87

Base: masterHead: master


📝 Commits (4)

  • 1d58b92 add possebility to read environment variables from .env files
  • 1783c3c add example and enhance readme
  • a8856fc fix handling of .env file and system environment variables
  • c1808eb fix unused error for staticcheck

📊 Changes

6 files changed (+96 additions, -20 deletions)

View changed files

.env.example (+5 -0)
📝 .gitignore (+1 -0)
📝 README.md (+18 -0)
📝 go.mod (+1 -0)
📝 go.sum (+2 -0)
📝 main.go (+69 -20)

📄 Description

Hello Telmate/proxmox-api-go maintainers,

I am just starting to contribute to the Proxmox ecosystem. I want to see a nice and useful terraform provider and do my part to it. As I learned now the Telmate/proxmox-api-go is the first crucial thing and I cloned the repo to play around with it to get started.

My Motivation:
When it came to exporting environment variables to setup the configuration, I thought .env files would be a nice thing to have. I usually have multiple small projects ongoing at the same time and always having to type export KEY=value is error prone and as it is part of the bash history also insecure.

Implementation:
To address this, I have integrated the godotenv package, which allows the application to automatically load environment variables from a .env file at runtime. This means users can now store their sensitive credentials safely in .env files, significantly reducing the risk of accidental exposure, mixing up things etc. I also added .env to the gitignore file, everybody should know that this is a sensitive file which must not be shared.

Changes Made:

  • Added godotenv as a dependency in go.mod.
  • Implemented .env file loading logic in the main initialization section of the application.
  • Updated the README.md to include instructions on how to use .env files with the Proxmox API Go client.

Thank you for considering my PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Telmate/proxmox-api-go/pull/311 **Author:** [@JamborJan](https://github.com/JamborJan) **Created:** 2/6/2024 **Status:** ✅ Merged **Merged:** 2/15/2024 **Merged by:** [@mleone87](https://github.com/mleone87) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (4) - [`1d58b92`](https://github.com/Telmate/proxmox-api-go/commit/1d58b9207a5c7ca4aca7b77f934dfb17c8f0d946) add possebility to read environment variables from .env files - [`1783c3c`](https://github.com/Telmate/proxmox-api-go/commit/1783c3c8dbb71b0b16fe86c068dcc7c24893e602) add example and enhance readme - [`a8856fc`](https://github.com/Telmate/proxmox-api-go/commit/a8856fc18a3511cdd81b5476dc65c248fac24431) fix handling of .env file and system environment variables - [`c1808eb`](https://github.com/Telmate/proxmox-api-go/commit/c1808eb8ac456cf723fb8c4e0200dc04075c3d7d) fix unused error for staticcheck ### 📊 Changes **6 files changed** (+96 additions, -20 deletions) <details> <summary>View changed files</summary> ➕ `.env.example` (+5 -0) 📝 `.gitignore` (+1 -0) 📝 `README.md` (+18 -0) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+2 -0) 📝 `main.go` (+69 -20) </details> ### 📄 Description Hello `Telmate/proxmox-api-go` maintainers, I am just starting to contribute to the Proxmox ecosystem. I want to see a nice and useful terraform provider and do my part to it. As I learned now the `Telmate/proxmox-api-go` is the first crucial thing and I cloned the repo to play around with it to get started. **My Motivation:** When it came to exporting environment variables to setup the configuration, I thought `.env` files would be a nice thing to have. I usually have multiple small projects ongoing at the same time and always having to type `export KEY=value` is error prone and as it is part of the bash history also insecure. **Implementation:** To address this, I have integrated the `godotenv` package, which allows the application to automatically load environment variables from a `.env` file at runtime. This means users can now store their sensitive credentials safely in `.env` files, significantly reducing the risk of accidental exposure, mixing up things etc. I also added `.env` to the gitignore file, everybody should know that this is a sensitive file which must not be shared. **Changes Made:** - Added `godotenv` as a dependency in `go.mod`. - Implemented `.env` file loading logic in the main initialization section of the application. - Updated the README.md to include instructions on how to use `.env` files with the Proxmox API Go client. Thank you for considering my PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:41:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmox-api-go#385
No description provided.