Skip to content

Commit

Permalink
Merge pull request #109 from JarvusInnovations/develop
Browse files Browse the repository at this point in the history
Release: gatekeeper v2.5.1
  • Loading branch information
themightychris authored Feb 2, 2021
2 parents 41fe97f + b665dd9 commit ce58f04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/k8s-deploy-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
steps:

- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: 'Initialize Chef Habitat environment'
uses: JarvusInnovations/habitat-action@action/v1
Expand Down
2 changes: 0 additions & 2 deletions helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ metadata:
namespace: {{ .Values.namespace }}
labels:
{{- include "gatekeeper-deployment.labels" . | nindent 4 }}
app: {{ .Release.Name }}
name: {{ .Release.Name }}-app
spec:
selector:
{{- include "gatekeeper-deployment.selectorLabels" . | nindent 4 }}
Expand Down
12 changes: 6 additions & 6 deletions php-classes/Gatekeeper/Utils/IPPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ public static function parse($pattern)
}

// try to load from filesystem cache
$cacheFilePath = join('/', [
Storage::getLocalStorageRoot(),
static::$fsRootDir,
$patternHash . '.php'
]);
$cacheDirPath = Storage::getLocalStorageRoot() . '/' . static::$fsRootDir;
$cacheFilePath = "{$cacheDirPath}/{$patternHash}.php";

try {
$closure = include($cacheFilePath);
Expand Down Expand Up @@ -80,7 +77,6 @@ public static function parse($pattern)

// fast path for static IP lists
if (count($subPatternsByType['cidr']) === 0 && count($subPatternsByType['wildcard']) === 0) {
// TODO: cache to a file?
return $cache[$patternHash] = $subPatternsByType['ip'];
}

Expand All @@ -107,6 +103,10 @@ public static function parse($pattern)
$closureFunctionString .= "};\n";

// write to filesystem
if (!is_dir($cacheDirPath)) {
mkdir($cacheDirPath, 0777, true);
}

file_put_contents($cacheFilePath, $closureFunctionString);

return $cache[$patternHash] = include($cacheFilePath);
Expand Down

0 comments on commit ce58f04

Please sign in to comment.