Skip to content

Commit

Permalink
Merge pull request #80 from kellerkinderDE/feature/customPortsHandling
Browse files Browse the repository at this point in the history
Add custom ports handling
  • Loading branch information
lx-wnk authored Jan 12, 2024
2 parents 3cfda45 + 5d796bc commit a55927e
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Test ${{ matrix.manifest }} example
run: |
cd ${GITHUB_WORKSPACE}/examples/${{ matrix.manifest }}
sed -i "s,url: github:kellerkinderDE/devenv-shopware?ref=v1.0.3,url: path:${GITHUB_WORKSPACE}," devenv.yaml
sed -i "s,url: github:kellerkinderDE/devenv-shopware?ref=v2.0.0,url: path:${GITHUB_WORKSPACE}," devenv.yaml
echo running on ${GITHUB_REPOSITORY} with ref ${GITHUB_REF_NAME}
direnv allow && direnv reload
devenv ci -vvv
Expand Down
20 changes: 16 additions & 4 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let
cfg = config.kellerkinder;

currentVersion = "v1.0.3";
currentVersion = "v2.0.0";

listEntries = path:
map (name: path + "/${name}") (builtins.attrNames (builtins.readDir path));
Expand Down Expand Up @@ -136,8 +136,20 @@ in {

enableMysqlBinLog = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''Enables MySQL binary logs'';
default = false;
};

httpPort = lib.mkOption {
type = lib.types.str;
description = ''Sets the HTTP port'';
default = "80";
};

httpsPort = lib.mkOption {
type = lib.types.str;
description = ''Sets the HTTPS port'';
default = "443";
};
};

Expand Down Expand Up @@ -194,8 +206,8 @@ in {
MAILER_URL = lib.mkDefault "smtp://127.0.0.1:1025?encryption=&auth_mode=";
MAILER_DSN = lib.mkDefault "smtp://127.0.0.1:1025?encryption=&auth_mode=";

APP_URL = lib.mkDefault "http://127.0.0.1:8000";
CYPRESS_baseUrl = lib.mkDefault "http://127.0.0.1:8000";
APP_URL = lib.mkDefault "http://127.0.0.1:${toString cfg.httpPort}";
CYPRESS_baseUrl = lib.mkDefault "http://127.0.0.1:${toString cfg.httpPort}";

APP_SECRET = lib.mkDefault "devsecret";

Expand Down
20 changes: 20 additions & 0 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,23 @@ Enables the MySQL Binary Log and adds configuration for it.
```
kellerkinder.enableMysqlBinLog = false;
```

# kellerkinder.httpPort
Sets the http port for caddy.

_This has to be a string_

*_Example_*
```
kellerkinder.httpPort = "8080";
```

# kellerkinder.httpsPort
Sets the https port for caddy.

_This has to be a string_

*_Example_*
```
kellerkinder.httpsPort = "8443";
```
11 changes: 11 additions & 0 deletions docs/Update.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Updates


## v2.0.0
* If you still want to use custom ports, take a look at the [options](Options.md#kellerkinder-httpPort).
* You have to adjust your `devenv.yaml` to
```yml
...
kellerkinder:
url: github:kellerkinderDE/devenv-shopware?ref=v2.0.0
flake: false
...
```
## v1.0.0
* You have to update to devenv version `0.6.3` or higher
* You have to remove `http`, `https` and the ports (e.g. `8000`) from `kellerkinder.additionalServerAlias`
Expand Down
2 changes: 1 addition & 1 deletion examples/sw5/devenv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixos-unstable
kellerkinder:
url: github:kellerkinderDE/devenv-shopware?ref=v1.0.3
url: github:kellerkinderDE/devenv-shopware?ref=v2.0.0
flake: false
phps:
url: github:fossar/nix-phps
Expand Down
2 changes: 1 addition & 1 deletion examples/sw6/devenv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixos-unstable
kellerkinder:
url: github:kellerkinderDE/devenv-shopware?ref=v1.0.3
url: github:kellerkinderDE/devenv-shopware?ref=v2.0.0
flake: false
phps:
url: github:fossar/nix-phps
Expand Down
7 changes: 2 additions & 5 deletions modules/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ let

caddyHostConfig = (lib.mkMerge
(lib.forEach vhostDomains (domain: {
"http://${toString domain}" = {
"http://${toString domain}:${toString cfg.httpPort}" = lib.mkDefault {
extraConfig = vhostConfig;
};
"https://${toString domain}" = {
extraConfig = vhostConfigTls;
};
"https://${toString domain}:8000" = {
"https://${toString domain}:${toString cfg.httpsPort}" = lib.mkDefault {
extraConfig = vhostConfigTls;
};
}))
Expand Down

0 comments on commit a55927e

Please sign in to comment.