generated from ddev/ddev-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.yaml
122 lines (102 loc) · 4.24 KB
/
install.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Details about the install.yaml file are at https://ddev.readthedocs.io/en/latest/users/extend/additional-services/#sections-and-features-of-ddev-get-add-on-installyaml
name: mittwald
# pre_install_actions - list of actions to run before installing the addon.
pre_install_actions:
- |
#ddev-nodisplay
if ddev debug configyaml | grep -q MITTWALD_API_TOKEN ; then
echo "Using existing MITTWALD_API_TOKEN."
else
printf "\nPlease enter mittwald API token: "
fi
- |
#ddev-description:set mittwald API token
#ddev-nodisplay
if ! ddev debug configyaml | grep -q MITTWALD_API_TOKEN ; then
token="${MITTWALD_API_TOKEN:-}"
if [[ -z "${token}" && -z "${DDEV_NONINTERACTIVE:-}" ]] ; then
read -s token
fi
if [[ -z "${token}" ]] ; then
echo "MITTWALD_API_TOKEN not set; please provide one in the web_environment configuration" >&2
exit 1
fi
ddev config global --web-environment-add MITTWALD_API_TOKEN=${token}
echo "MITTWALD_API_TOKEN set globally"
fi
- |
#ddev-nodisplay
if ! ddev debug configyaml | grep -q MITTWALD_APP_INSTALLATION_ID ; then
printf "Please enter mittwald app installation ID (formatted a-XXXXXX): "
fi
- |
#ddev-description:set mittwald app installation ID
#ddev-nodisplay
if ! ddev debug configyaml | grep -q MITTWALD_APP_INSTALLATION_ID ; then
app_id="${MITTWALD_APP_INSTALLATION_ID:-}"
if [[ -z "${app_id}" && -z "${DDEV_NONINTERACTIVE:-}" ]] ; then
read app_id
fi
if [[ -z "${app_id}" ]] ; then
echo "MITTWALD_APP_INSTALLATION_ID not set; please provide one in the web_environment configuration" >&2
exit 1
fi
ddev config --web-environment-add MITTWALD_APP_INSTALLATION_ID=${app_id}
fi
# list of files and directories listed that are copied into project .ddev directory
# Each file should contain #ddev-generated so it can be replaced by a later `ddev get`
# if it hasn't been modified by the user.
# DDEV environment variables can be interpolated into these filenames
project_files:
- web-build/Dockerfile.mittwald
- web-build/mw-util
- providers/mittwald.yaml
# List of files and directories that are copied into the global .ddev directory
# DDEV environment variables can be interpolated into these filenames
global_files:
- commands
# List of add-on names that this add-on depends on
dependencies:
# - redis
# DDEV environment variables can be interpolated into these actions
post_install_actions:
- |
#ddev-description:write mittwald specific configuration file
# Load all configured MITTWALD_ environment variables into the current shell;
# we'll need them for the mittwald/cli calls.
{{ range $var := .DdevGlobalConfig.web_environment }}
{{ if hasPrefix "MITTWALD_" $var }}
export {{ $var }}
{{ end }}
{{ end }}
{{ range $var := .DdevProjectConfig.web_environment }}
{{ if hasPrefix "MITTWALD_" $var }}
export {{ $var }}
{{ end }}
{{ end }}
if [[ -e config.mittwald.yaml || -n "${MITTWALD_SKIP_CONFIG:-}" ]] ; then
echo "mittwald specific config file already exists"
else
if ! docker run --rm mittwald/cli mw ddev render-config --help >/dev/null ; then
echo "The installed version of the mw CLI has no "ddev render-config" command available." >&2
echo "Make sure you use the latest version of the mw CLI." >&2
else
docker run --rm -e MITTWALD_API_TOKEN mittwald/cli mw ddev render-config "${MITTWALD_APP_INSTALLATION_ID}" > config.mittwald.yaml
echo "mittwald specific config file written to config.mittwald.yaml"
fi
fi
- |
echo -e "\n🚀 All done! You can now do the following:\n"
echo " - Use 'ddev mw ...' to run the mittwald CLI from within the web container"
echo " - Use 'ddev pull mittwald' to download the configured app"
echo " - Use 'ddev push mittwald' to upload the app to the mittwald platform (DANGEROUS)"
# Shell actions that can be done during removal of the add-on
removal_actions:
# - rm ~/.ddev/commands/web/somecommand
# Advanced usage - yaml files can be read in and then used as go template actions
# in pre_install_actions and post_install_actions
# See example in
# https://github.com/rfay/ddev/blob/20220606_yaml_read_experiment/cmd/ddev/cmd/testdata/TestCmdGetComplex/recipe/install.yaml
yaml_read_files:
# someyaml: someyaml.yaml
# otheryaml: someotheryaml.yaml