Pārlūkot izejas kodu

Moved environment variables to config file

main
Simon Bowie pirms 3 gadiem
vecāks
revīzija
f7f539e956
4 mainītis faili ar 15 papildinājumiem un 1 dzēšanām
  1. +1
    -0
      .gitignore
  2. +9
    -0
      config.env.template
  3. +2
    -0
      docker-compose.yml
  4. +3
    -1
      site/public/index.php

+ 1
- 0
.gitignore Parādīt failu

@@ -1,3 +1,4 @@
.DS_Store
config.env

solrdata

+ 9
- 0
config.env.template Parādīt failu

@@ -0,0 +1,9 @@
# This config file contains the environment variables for the application passed to PHP through Docker Compose. Copy the template file to config.env and fill in the variables.

# Solr variables
# Hostname for Solr
SOLR_HOSTNAME=
# Solr port, usually 8983
SOLR_PORT=
# Solr core
SOLR_CORE=

+ 2
- 0
docker-compose.yml Parādīt failu

@@ -5,6 +5,8 @@ services:
container_name: php
build:
context: ./php
env_file:
- config.env
ports:
- '9000:9000'
volumes:

+ 3
- 1
site/public/index.php Parādīt failu

@@ -5,7 +5,9 @@ $random = rand();

// Assemble a query string to send to Solr. This uses the Solr hostname from config.env. Solr's query syntax can be found at many sites including https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html
// This query retrieves only the bib identifier field for records which satisfy the search query
$solrurl = 'http://host.docker.internal:8983/solr/epo_data/select?q.op=OR&q=*%3A*&wt=json&sort=random_' . $random . '%20asc';
#$solrurl = 'http://host.docker.internal:8983/solr/epo_data/select?q.op=OR&q=*%3A*&wt=json&sort=random_' . $random . '%20asc';
$solrurl = 'http://' . $_ENV["SOLR_HOSTNAME"] . ':' . $_ENV["SOLR_PORT"] . '/solr/' . $_ENV["SOLR_CORE"] . '/select?q.op=OR&q=*%3A*&wt=json&sort=random_' . $random . '%20asc';


// Perform Curl request on the Solr API
$ch = curl_init();

Notiek ielāde…
Atcelt
Saglabāt