0

I'm writing a web service in PHP using the slim framework. Any request made to any endpoint will only be allowed if (a) the request is coming from a list of IPs (b) the HTTP request header contains a secret string, which is static (I know this isn't the best way to secure a web service, but this service is mostly for internal use and we don't need anything more complicated).

Should I store the list of IPs and the shared secret in a JSON file or should I initialize the array of IPs and the shared secret string in the PHP script itself? Storing it in a JSON file would mean that the data would have to be read from disk on every HTTP request. I'm assuming this is bad as far as performance is concerned?

AyushISM
  • 381
  • 7
  • 21

1 Answers1

0

You can define a file of const with all IPs: https://secure.php.net/manual/it/function.define.php and than used it with require

notdodo
  • 149
  • 2
  • 15