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

Request: Make use of environmental variables in docker-compose.yaml #76

Open
Katorone opened this issue Nov 10, 2021 · 0 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed wontfix This will not be worked on
Milestone

Comments

@Katorone
Copy link

Using environmental variables will allow users to pull this git without having to reconfigure their settings. An .env file can be used to store these settings.
https://docs.docker.com/compose/environment-variables/

Proposed changes:

environment:
  OVPN_SERVER_NET: ${ENV_OVPN_SERVER_NET}
  OVPN_SERVER_MASK: ${ENV_OVPN_SERVER_MASK}
volumes:
  - ${ENV_BASEDIR}/easyrsa_master:/etc/openvpn/easyrsa
  - ${ENV_BASEDIR}/ccd_master:/etc/openvpn/ccd

environment:
  OVPN_DEBUG: ${ENV_OVPN_DEBUG}
  OVPN_VERBOSE: ${ENV_OVPN_VERBOSE}
  OVPN_NETWORK: ${ENV_OVPN_NETWORK}
  EASYRSA_PATH: ${ENV_EASYRSA_PATH}
  OVPN_SERVER: ${ENV_OVPN_SERVER}
  OVPN_INDEX_PATH: ${ENV_OVPN_INDEX_PATH}
volumes:
  - ${ENV_BASEDIR}/easyrsa_master:/mnt/easyrsa
  - ${ENV_BASEDIR}/ccd_master:/mnt/ccd

The environmental variables can be documented and edited in the .env file. It allows users more flexibility to how they organize and deploy the openvpn-server. For instance, I don't like that the volumes are in the same directory that the git clone is in, so I'd prefer to have a structure like:

basedir
|_ .env
|_ easyrsa_master
|_ ccd_master
|_ ovpn-admin
    |_ docker-compose -p openvpn-master --env-file ../.env up -d --build

Having a flat configuration file that's outside of the git repo directory allows users to more easily pull changes without having to manually edit the docker-compose.yaml. An adjusted start.sh could take the path to the .env file, add any missing variables and alert users of important changes.

I'd be more than happy to do a pull request with these proposed changes, though I'm by no means an expert in either docker, bash or git.

@pashcovich pashcovich added the wontfix This will not be worked on label Nov 25, 2021
@pashcovich pashcovich added enhancement New feature or request help wanted Extra attention is needed labels May 24, 2022
@pashcovich pashcovich added this to the 2.1 milestone Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants