-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Change of the candid snap." (#198)
This reverts commit 6b5ed0d.
- Loading branch information
Showing
9 changed files
with
126 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## Documentation can be found here: https://github.com/canonical/candid/blob/master/docs/configuration.md | ||
|
||
## Server URLs and ports | ||
listen-address: :8081 | ||
private-addr: 127.0.0.1 | ||
location: 'http://%LOCATION%:8081' | ||
|
||
## Persistent storage | ||
# Defaults to non-persistent memory storage, install PostgreSQL or MongoDB | ||
# and configure them below before using this service in production | ||
storage: | ||
type: memory | ||
|
||
#storage: | ||
# type: mongodb | ||
# address: 127.0.0.1:27017 | ||
|
||
#storage: | ||
# type: postgres | ||
# connection-string: postgres://user:pass@localhost/candid | ||
|
||
## Identity providers | ||
# Configure this with whatever authentication system you're using | ||
identity-providers: | ||
- type: static | ||
name: static | ||
users: | ||
user1: | ||
name: User One | ||
email: user1@example.com | ||
password: password1 | ||
groups: | ||
- group1 | ||
- group3 | ||
user2: | ||
name: User Two | ||
email: user2@example.com | ||
password: password2 | ||
groups: | ||
- group2 | ||
- group3 | ||
|
||
## Logging | ||
logging-config: INFO | ||
|
||
## Authentication keys | ||
public-key: %PUBLIC-KEY% | ||
private-key: %PRIVATE-KEY% | ||
|
||
admin-agent-public-key: %ADMIN-PUBLIC-KEY% | ||
|
||
# Don't change, snap-specific paths | ||
access-log: /var/snap/candid/common/logs/candid.access.log | ||
resource-path: /snap/candid/current/www/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh -eu | ||
url=$(grep ^location /var/snap/candid/current/config.yaml | cut -d: -f2- | sed "s/[ '\"]//g" || true) | ||
|
||
if [ -z "${CANDID_URL:-}" ] && [ -n "${url}" ]; then | ||
export CANDID_URL=${url} | ||
fi | ||
|
||
exec candid "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash -eu | ||
|
||
CONFIG_FILE="${SNAP_DATA}/config.yaml" | ||
ADMIN_AGENT_FILE="${SNAP_DATA}/admin.keys" | ||
|
||
if [ ! -e "$CONFIG_FILE" ]; then | ||
cp "${SNAP}/config/config.yaml" "$CONFIG_FILE" | ||
|
||
# replace hostname | ||
hostname="$(hostname -f)" | ||
if [ -n "$hostname" ]; then | ||
sed -i "s#%LOCATION%#${hostname}#g" "$CONFIG_FILE" | ||
fi | ||
|
||
# setup keys | ||
key="$(bakery-keygen)" | ||
private_key=$(echo "$key" | jq -r .private) | ||
public_key=$(echo "$key" | jq -r .public) | ||
sed -i "s#%PRIVATE-KEY%#${private_key}#g" "$CONFIG_FILE" | ||
sed -i "s#%PUBLIC-KEY%#${public_key}#g" "$CONFIG_FILE" | ||
|
||
# create admin credentials | ||
admin_key="$(bakery-keygen)" | ||
admin_private_key=$(echo "$admin_key" | jq -r .private) | ||
admin_public_key=$(echo "$admin_key" | jq -r .public) | ||
cat >"$ADMIN_AGENT_FILE" <<EOF | ||
{ | ||
"key": { | ||
"public": "${admin_public_key}", | ||
"private": "${admin_private_key}"}, | ||
"agents": [ | ||
{ | ||
"url": "http://${hostname}:8081", | ||
"username": "admin@candid" | ||
} | ||
] | ||
} | ||
EOF | ||
sed -i "s#%ADMIN-PUBLIC-KEY%#${admin_public_key}#g" "$CONFIG_FILE" | ||
fi | ||
|
||
exec candidsrv "$CONFIG_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters