Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change prefix in piler.js #163

Merged
merged 6 commits into from
Aug 24, 2024
Merged

change prefix in piler.js #163

merged 6 commits into from
Aug 24, 2024

Conversation

th-2021
Copy link
Contributor

@th-2021 th-2021 commented Aug 20, 2024

This patch sets base_url in piler.js according to the setting on config-site.php.

@th-2021 th-2021 requested a review from jsuto as a code owner August 20, 2024 14:29
Copy link
Owner

@jsuto jsuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather like to see a simpler solution. Eg. just set PATH_PREFIX as a docker-compose env var, and if it exists in the container then you simply use sed to fix piler.js, and update config-site.php with this value, eg. $config['PATH_PREFIX'] = ....; if it's not already in the file.

Also, please use $( ... ) format for running commands, not the obsoleted backtick (`)

@th-2021
Copy link
Contributor Author

th-2021 commented Aug 22, 2024

what about $config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . '/mail/';
Should I change util/config-site.php.in to have PATH_PREFIX in it and replace it in start with the real PATH_PREFIX?

@jsuto
Copy link
Owner

jsuto commented Aug 22, 2024

Yes, you are correct. I suggest to add config['PATH_PREFIX'] = '/'; to util/config-site.php.in before the SITE_URL line.

@jsuto
Copy link
Owner

jsuto commented Aug 22, 2024

And also fix etc/config-site.dist.php as well, please.

docker/start.sh Outdated Show resolved Hide resolved
docker/start.sh Outdated
then
log "PATH_PREFIX set $PATH_PREFIX"
sed -i -e "s#location.origin\ +\ .*#location.origin\ +\ $PATH_PREFIX,#" /var/piler/www/assets/js/piler.js
sed -i "s%PATH_PREFIX%${PATH_PREFIX}%" "$CONFIG_SITE_PHP"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't cut it, see my next comment below.

@@ -3,7 +3,7 @@
define('SITE_NAME_CONST', 'SITE_NAME');

$config[SITE_NAME_CONST] = 'HOSTNAME';
$config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . '/';
$config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . 'PATH_PREFIX';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PATH_PREFIX is a non-existing variable. What we need is

$config['PATH_PREFIX'] = '/';
$config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . $config['PATH_PREFIX'];

Then in start.sh you need to fix $config['PATH_PREFIX'] = '/';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used PATH_PREFIX like HOSTNAME in the file. and replaced it with the env variable in start.sh I also added $config['PATH_PREFIX'].
In my setup it looks like:
...
$config['SITE_URL'] = 'http://' . $config[SITE_NAME_CONST] . '/mail/';
...
$config['PATH_PREFIX'] = '/mail/';
...

Adding $config['PATH_PREFIX'] is an little bit more tricky.

@jsuto
Copy link
Owner

jsuto commented Aug 22, 2024

OK, it looks good. However, there's an issue, see #167. The problem is that with the current setup you can't override the BRANDING_* variables, so they need to be restored to the original place as they were. Please check out the other PR, and we need to come to an agreement how to solve this catch 22 issue.

@jsuto jsuto merged commit 891903b into jsuto:master Aug 24, 2024
4 checks passed
@th-2021 th-2021 deleted the path-prefix branch August 24, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants