Просмотр исходного кода

Moved environment variables to config file

main
Simon Bowie 4 лет назад
Родитель
Сommit
f7f539e956
4 измененных файлов: 15 добавлений и 1 удалений
  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 Просмотреть файл

.DS_Store .DS_Store
config.env


solrdata solrdata

+ 9
- 0
config.env.template Просмотреть файл

# 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 Просмотреть файл

container_name: php container_name: php
build: build:
context: ./php context: ./php
env_file:
- config.env
ports: ports:
- '9000:9000' - '9000:9000'
volumes: volumes:

+ 3
- 1
site/public/index.php Просмотреть файл



// 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 // 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 // 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 // Perform Curl request on the Solr API
$ch = curl_init(); $ch = curl_init();

Загрузка…
Отмена
Сохранить