github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/c0158.yml (about) 1 doc_meta: | 2 folder: user-interaction 3 title: externise exec profile 4 head: | 5 This shows how to externlise the exec profile 6 7 sections: 8 - title: How does it work 9 content: | 10 execution profile extend dev instance: 11 12 ``` 13 up ngo task -d ./tests/functests -t c0158 -p dev1_use_memcache --configdir=./tests/functests 14 ``` 15 16 You can use ref and redir to redirect the detailed env var key value pairs to another individual file if it turns out there are too many entries to be living in up.yml 17 18 * ref 19 ref is the tag for refrencing to the file name to load 20 21 * refdir 22 refdir is the tag for refrencing to the directory which the ref file is located.By default this would be the global refdir and you can leave it empty if the file is living in the same directory 23 24 - title: Relavant 25 content: environment variables 26 refs: 27 - title: set env var 28 link: ../../env-vars/c0048/ 29 - title: get env var 30 link: ../../env-vars/c0046/ 31 32 notes: 33 - add feature of execution profile 34 35 eprofiles: 36 - name: dev1_use_memcache 37 instance: dev 38 ref: d0158_eprofile_dev.yml 39 # refdir: ./tests/functests 40 41 scopes: 42 - name: global 43 vars: 44 db_driver: postgres 45 port: 5432 46 dvars: 47 - name: A_GLOBAL_ENV_VAR 48 value: a_global_env_var 49 flags: 50 - envVar 51 52 - name: nonprod 53 members: 54 - dev 55 - staging 56 vars: 57 db_host: nonpord_database.test.host 58 db_port: 8354 59 db_user: test_db_user 60 db_password: could_be_encrypted_using_upcmd_too 61 dvars: 62 - name: db_password 63 value: '6HmsmiJIW1PfIXcF4WwOKOMDiL7PstgfKs2aRFajrwY=' 64 65 - name: prod 66 members: [prod] 67 vars: 68 host_alias: prod 69 70 - name: dev 71 vars: 72 host_alias: dev 73 dvars: 74 - name: db_host 75 value: '{{ env "DB_HOST" |default "nonpord_database.test.host" }}' 76 - name: A_DEV_ENV_VAR 77 value: '{{ env "A_GLOBAL_ENV_VAR" |default "A_GLOBAL_ENV_VAR_NOT_LOCATED" }}' 78 79 - name: staging 80 vars: 81 host_alias: staging 82 83 - name: prod 84 vars: 85 host_alias: prod 86 db_host: pord_database.proddb.host 87 db_user: prod_db_user 88 dvars: 89 - name: db_password 90 value: 'prod_encrypte_aes' 91 92 dvars: 93 - name: db_hostname 94 value: '{{.host_alias}}.myapp.com' 95 - name: db_url 96 value: 'jdbc:{{.db_driver}}://{{.db_hostname}}:{{.db_port}}/test?user={{.db_user}}&password={{.db_password}}&ssl=true' 97 98 tasks: 99 - 100 name: task 101 task: 102 103 - 104 func: cmd 105 do: 106 - name: inspect 107 cmd: 108 - exec_vars 109 - 110 name: assert 111 cmd: 112 - '{{eq .A_GLOBAL_ENV_VAR "a_global_env_var"}}' 113 - '{{eq .A_DEV_ENV_VAR "a_global_env_var"}}' 114 - '{{eq .db_host "devtest_database.mycompany.local"}}' 115 - '{{eq .db_url "jdbc:postgres://dev.myapp.com:8354/test?user=test_db_user&password=6HmsmiJIW1PfIXcF4WwOKOMDiL7PstgfKs2aRFajrwY=&ssl=true"}}'