Commit 77ccda89 authored by Aard's avatar Aard

Add variable URLs for credentials files

parent 268affd1
......@@ -126,6 +126,13 @@ QString Ssu::credentialsScope(QString repoName, bool rndRepo){
return "your-configuration-is-broken-and-does-not-contain-credentials-scope";
}
QString Ssu::credentialsUrl(QString scope){
if (settings->contains("credentials-url-" + scope))
return settings->value("credentials-url-" + scope).toString();
else
return "your-configuration-is-broken-and-does-not-contain-credentials-url-for-" + scope;
}
QString Ssu::deviceFamily(){
QString model = deviceModel();
......
......@@ -36,6 +36,10 @@ class Ssu: public QObject {
* @return a string containing the scope; it can be used to look up login credentials using credentials()
*/
QString credentialsScope(QString repoName, bool rndRepo=false);
/**
* Return the URL for which credentials scope is valid
*/
QString credentialsUrl(QString scope);
/**
* Try to find the device family for the system this is running on
*/
......
......@@ -14,3 +14,4 @@ credentials-scope=example
[2]
release=latest
credentials-url-example=https://example.com
......@@ -84,7 +84,7 @@ void SsuUrlResolver::run(){
credentialsFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
QTextStream out(&credentialsFile);
QPair<QString, QString> credentials = ssu.credentials(credentialsScope);
out << "[ssu-credentials]\n";
out << "[" << ssu.credentialsUrl(credentialsScope) << "]\n";
out << "username=" << credentials.first << "\n";
out << "password=" << credentials.second << "\n";
out.flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment