TYPO3 - Using Site Configuration in TypoScript - BaseUrl - yaml

in the TYPO3 Docu we can read the example: Using Site Configuration in TypoScript
Site-Config Yaml to typoscript.
But this Code-Example work only in the "page" corner.
page.10 = TEXT
page.10.data = site:base
page.10.wrap = This is your base URL: |
And i use this here in the FLUIDTEMPLATE:
page {
10 {
variables {
# BaseURL
siteConfigBase = TEXT
siteConfigBase {
data = site:base
}
}
}
This works fine, in the f.debug is the right output siteConfigBase = https://example.org
How can i pass the values to config.baseURL ?

config.baseURL supports only strings but not stdWrap.
But you can use a condition to get what you want:
[site("identifier") == "foo"]
config.baseURL = foo
[global]
The identifier is the name of the folder of your site configuration.

Related

OCI: How to get in terraform OKE prepared images?

all
I want to select automatically the image for the node in kubernetes nodepool when I select Shape, Operating System and Version. For this, I have this datasource
data "oci_core_images" "images" {
#Required
compartment_id = var.cluster_compartment
#Optional
# display_name = var.image_display_name
operating_system = var.cluster_node_image_operating_system
operating_system_version = var.cluster_node_image_operating_system_version
shape = var.cluster_node_shape
state = "AVAILABLE"
# sort_by = var.image_sort_by
# sort_order = var.image_sort_order
}
and I select the image in oci_containerengine_node_poolas
resource "oci_containerengine_node_pool" "node_pool01" {
# ...
node_shape = var.cluster_node_shape
node_shape_config {
memory_in_gbs = "16"
ocpus = "1"
}
node_source_details {
image_id = data.oci_core_images.images.images[0].id
source_type = "IMAGE"
}
}
But my problem seems to be that not all images are prepared for OKE (with the OKE software install in cloudinit).
So the documentation suggest to use the oci cli command:
oci ce node-pool-options get --node-pool-option-id all
And my question is: How can I do this in data in terraform (recover only OKE ready images)
You can use the oci_containerengine_node_pool_option
data "oci_containerengine_node_pool_option" "test_node_pool_option" {
#Required
node_pool_option_id = oci_containerengine_node_pool_option.test_node_pool_option.id
#Optional
compartment_id = var.compartment_id
}
Ref doc : https://registry.terraform.io/providers/oracle/oci/latest/docs/data-sources/containerengine_node_pool_option
Github issue : https://github.com/oracle-terraform-modules/terraform-oci-oke/issues/263
Change log release details : https://github.com/oracle-terraform-modules/terraform-oci-oke/blob/main/CHANGELOG.adoc#310-april-6-2021

VueJS i18n - How to change the variable prefix in translation files

I'm doing an app using Laravel inertia and Vue, we wanted to add i18n to the app and use the same translation files for both laravel and i18n, the problem is the variable interpolation, laravel by default use :variable but vue i18n use {variable}
I tried to create a custom formatter based on what i've found here but using a custom formatter seems deprecated since I have this in my console: [intlify] Not supported 'formatter'.
I've seen on the official i18n doc that i18n is supposed to have an option for both prefix and suffix for the variable interpolation but it does not seems to exists in vue-i18n.
Does anyone ever experienced this or have an idea to solve this 'issue' ?
I run a for loop in my translation jsons and converted :variable syntax to {variable}
import {createI18n} from 'vue-i18n'
import zhCN from '../lang/zh-CN.json';
export function initializeI18n() {
let en = {};
Object.entries(zhCN).forEach(([key, value]) => {
let newEnValue = key;
en[key] = key;
if (value.includes(':')) {
let arr = value.match(/\B\:\w+/ig);
arr.forEach(matchedStr => {
let cleanMatchedStr = matchedStr.replace(':', '')
value = value.replace(matchedStr, `{${cleanMatchedStr}}`)
newEnValue = newEnValue.replace(matchedStr, `{${cleanMatchedStr}}`)
})
zhCN[key] = value;
en[key] = newEnValue;
}
})
return createI18n({
locale: window.__DEFAULT_LOCALE__,
fallbackLocale: window.__FALLBACK_LOCALE__,
messages: {
'zh-CN': zhCN,
en
},
silentFallbackWarn: true,
silentTranslationWarn: true
});
}
This was, putting in es.js
"Hello :name": "Hola :name"
should work as expected:
{{ $t("Hello :name", {name: 'world'}) }},

How to whitelist Atlassian/Bitbucket IPs in AWS EC2 security group?

We want Bitbucket webhooks to trigger our CI tool which runs on an AWS EC2 instance, protected with ingress rules from general access.
Bitbucket provides a page listing their IP addresses at https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/
They also have a machine-consumable version at https://ip-ranges.atlassian.com/ for Atlassian IPs in general.
I wonder, what is an efficient approach to add and maintain this list in AWS EC2 security groups, e.g. via terraform.
I ended up scraping the machine-consumable json from their page, and let terraform manage the rest. The step of getting the json is left as a manual task.
resource "aws_security_group_rule" "bitbucket-ips-sgr" {
security_group_id = "your-security-group-id"
type = "ingress"
from_port = 443
to_port = 443
protocol = "TCP"
cidr_blocks = local.bitbucket_cidrs_ipv4
ipv6_cidr_blocks = local.bitbucket_cidrs_ipv6
}
locals {
bitbucket_cidrs_ipv4 = [for item in local.bitbucket_ip_ranges_source.items:
# see https://stackoverflow.com/q/47243474/1242922
item.cidr if length(regexall(":", item.cidr)) == 0
]
bitbucket_cidrs_ipv6 = [for item in local.bitbucket_ip_ranges_source.items:
# see https://stackoverflow.com/q/47243474/1242922
item.cidr if length(regexall(":", item.cidr)) > 0
]
# the list originates from https://ip-ranges.atlassian.com/
bitbucket_ip_ranges_source = jsondecode(
<<JSON
the json output from the above URL
JSON
)
}
I improved on Richard's answer and wanted to add that TF's http provider can fetch the JSON for you, and, with a slight tweak to the jsondecode() call, that same for loop still plays.
provider "http" {}
data "http" "bitbucket_ips" {
url = "https://ip-ranges.atlassian.com/"
request_headers = {
Accept = "application/json"
}
}
locals {
bitbucket_ipv4_cidrs = [for c in jsondecode(data.http.bitbucket_ips.body).items : c.cidr if length(regexall(":", c.cidr)) == 0]
bitbucket_ipv6_cidrs = [for c in jsondecode(data.http.bitbucket_ips.body).items : c.cidr if length(regexall(":", c.cidr)) > 0]
}
output "ipv4_cidrs" {
value = local.bitbucket_ipv4_cidrs
}
output "ipv6_cidrs" {
value = local.bitbucket_ipv6_cidrs
}

Terraform: set max_buckets in ElasticSearch

I need to set max_buckets in elasticsearch aws. So far I've tried using a max_buckets key right in the module block, but that didn't work. Next try was using advanced_options
module "elasticsearch" {
es_version = "6.3"
advanced_options = {
"search.max_buckets" = "123456"
}
But this causes:
Error: Unsupported argument
on elasticsearch.tf line 14, in module "elasticsearch":
14: advanced_options = {
How can I set max_buckets?
Which module are you using? The aws_elasticsearch_domain resource has the advanced_options argument.
advanced_options - Key-value string pairs to specify advanced configuration options. Note that the values for these configuration options must be strings (wrapped in quotes).
resource "aws_elasticsearch_domain" "es" {
domain_name = "${var.domain}"
elasticsearch_version = "6.3"
advanced_options = {
"rest.action.multi.allow_explicit_index" = "true"
}
}
Could you provide more details about your implementation? It seems in your example that a double-quote is missing for search.max_buckets and if you're using a module, I think you should pass the source argument.

Typo3 9.x ajax call

Configuration about a single route for ajax call: getamministrazioni.json
I tried to change configuration site as follow:
...
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
-
routePath: '/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
PageTypeSuffix:
type: PageType
default: .html
map:
.html: 0
getamministrazioni.json: 1035343
errorHandling: { }
routes: { }
...
And in setup.typoscript i have:
GetAmministrazioni = PAGE
GetAmministrazioni {
typeNum = 1035343
config {
disableAllHeaderCode = 1
debug = 0
no_cache = 1
additionalHeaders {
10 {
header = Content-Type: application/json
replace = 1
}
}
}
10 < tt_content.list.20.my_controller_getamministrazioni
}
It works but for all pages.
/home/getamministrazioni.json
/page1/getamministrazioni.json
etc.. etc..
I want a single route from root '/getamministrazioni.json
how i can do that?
There is a possibility to limit the routing to specific page ids:
limitToPages: 1
But this will limit your whole mapping configuration to page id 1, also the .html suffix (which you don't want to, I guess).
Unfortunately, it is currently not possible to create multiple Route Enhancers with the same name, like in the following, non-working example:
PageTypeSuffix:
type: PageType
map:
.html: 0
PageTypeSuffix:
type: PageType
limitToPages: 1
map:
sitemap.xml: 1533906435
Two possible workarounds:
Create your own RouteEnhancer, which just extends TYPO3\CMS\Core\Routing\Enhancer\PageTypeDecorator to allow a different name (see custom enhancers)
Redirect your json page type to an error page, if page id is not 0 (no routing neccessary, as TypoScript avoids delivering of this page type)
[getTSFE().id != 1]
seo_sitemap.config {
additionalHeaders.10 {
header = Location: /error.html
}
}
[END]
I found another solution. I create a plugin and i use controller to print json and i 'return' false. In template setup strip all html and i change header content type. So in every page i insert a a plugin as content that print the json

Resources