瀏覽代碼

Moved environment variables to config file

main
Simon Bowie 3 年之前
父節點
當前提交
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 查看文件

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

solrdata

+ 9
- 0
config.env.template 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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();

Loading…
取消
儲存