Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
enable simple evaluation
skoranda committed May 1, 2017
1 parent 297e2e5 commit 0fafe55
Showing 2 changed files with 69 additions and 7 deletions.
63 changes: 57 additions & 6 deletions comanage-registry-basic-auth/docker-comanage-entrypoint
@@ -26,6 +26,63 @@ else
OUTPUT=/dev/null
fi

# Make sure the directory structure we need is available
# in the data volume for $COMANAGE_REGISTRY_DIR/local
mkdir -p "$COMANAGE_REGISTRY_DIR/local/Config"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/Plugin"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/View/Pages/public"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/webroot/img"

# If the COmanage Registry configuration files database.php and email.php
# do not exist create simple versions to aid people evaluating the tool.
if [ ! -f "$COMANAGE_REGISTRY_DIR/local/Config/database.php" ]; then
cat >> "$COMANAGE_REGISTRY_DIR/local/Config/database.php" <<"EOF"
<?php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Postgres',
'persistent' => false,
'host' => 'comanage-registry-database',
'login' => 'registry_user',
'password' => 'password',
'database' => 'registry',
'prefix' => 'cm_',
);
}
EOF

fi

if [ ! -f "$COMANAGE_REGISTRY_DIR/local/Config/email.php" ]; then
cat >> "$COMANAGE_REGISTRY_DIR/local/Config/email.php" <<"EOF"
<?php
class EmailConfig {
public $default = array(
'transport' => 'Smtp',
'host' => 'tls://smtp.gmail.com',
'port' => 465,
'username' => 'somebody@gmail.com',
'password' => 'password'
);
}
EOF

fi

# If the basic auth password file does not exist create a simple version to
# aid people evaluating the tool.
if [ ! -f "/etc/apache2/passwords" ]; then
cat >> /etc/apache2/passwords <<"EOF"
registry.admin:$apr1$qqrvav7G$nSHYErU4ljDPmO1wNBG6e0
EOF

fi

# Loop until we are able to open a connection to the database.
DATABASE_TEST_SCRIPT="$COMANAGE_REGISTRY_DIR/app/Console/Command/DatabaseTestShell.php"

@@ -120,12 +177,6 @@ popd > "$OUTPUT" 2>&1
# set the ownership of those files appropriately.
chown -R www-data:www-data "$COMANAGE_REGISTRY_DIR/app/tmp"

# Make sure the directory structure we need is available
# in the data volume for $COMANAGE_REGISTRY_DIR/local
mkdir -p "$COMANAGE_REGISTRY_DIR/local/Config"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/Plugin"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/View/Pages/public"
mkdir -p "$COMANAGE_REGISTRY_DIR/local/webroot/img"

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
13 changes: 12 additions & 1 deletion comanage-registry-postgres/create-pg_hba.conf.sh
@@ -23,8 +23,19 @@ set -e

mkdir -p /etc/postgres

cat > /etc/postgres/pg_hba.conf <<EOF
if [ -n "$COMANAGE_REGISTRY_POSTGRES_USER_PASSWORD" ]
then

cat >> /etc/postgres/pg_hba.conf <<EOF
local all postgres peer
host $COMANAGE_REGISTRY_POSTGRES_DATABASE $COMANAGE_REGISTRY_POSTGRES_USER 127.0.0.1/32 md5
host $COMANAGE_REGISTRY_POSTGRES_DATABASE $COMANAGE_REGISTRY_POSTGRES_USER samenet md5
EOF

else
cat >> /etc/postgres/pg_hba.conf <<EOF
local all postgres peer
host $COMANAGE_REGISTRY_POSTGRES_DATABASE $COMANAGE_REGISTRY_POSTGRES_USER samenet trust
EOF

fi

0 comments on commit 0fafe55

Please sign in to comment.