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

Having issues with setDirectory #110

Open
nick-janda opened this issue Sep 10, 2018 · 1 comment
Open

Having issues with setDirectory #110

nick-janda opened this issue Sep 10, 2018 · 1 comment
Assignees

Comments

@nick-janda
Copy link

I have a multi-page aurelia app using a shared main.ts. So, depending on the location of the current index.html, the path to the config file changes.

The config file and folder are defaults. So, a "config" folder in the root of the website with a config.json.

I have some logic to determine the path back to this location, but using setDirectory never changes this.
For example: config.setDirectory('../../config') does nothing. It tries to find the config location in the current folder. Interestingly, if i use ../../testconfig, it does look for the correct name (testconfig), but still at the current folder path rather than backing up two folders.

Here's a code snippet:
.plugin('aurelia-configuration', config => {
let configFolderParts = window.location.pathname.split('/');
if (configFolderParts.length > 1) {
let levels = configFolderParts.filter(i => i !== "").map(i => "../");
let configFolder = levels.reduce((path, i) => path = path + '../');
let newDirectory = ${configFolder}config;
config.setDirectory(newDirectory);
}
config.setEnvironments({
development: ['localhost','localhost:.'],
test: ['appdev.essette.com'],
prod: ['prod.essette.com']
});
})

@Vheissu
Copy link
Owner

Vheissu commented Dec 3, 2018

@nickj41 sorry for the delay, I am looking at this issue as part of a next update which will hopefully streamline and simplify the loading of configuration files and path configuration.

@Vheissu Vheissu added the bug label Dec 3, 2018
@Vheissu Vheissu self-assigned this Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants